私は自分のアプリケーションで長い間javascriptゲッターを使用していて、常に考えていました
彼らがこのように働くこと:
myobject.prototype.__defineGetter__('something', function () {
return DoSomeHeavyComputation() // this will be executed only once and will be saved
})
new myobject()
myobject.something // the computation will be done here
myobject.something // no computation will be done here.
毎回計算が行われていることがわかりました...
それらが実際にどのように機能するかを示すリソースまたは何かがありますか?