3
我讀knockout.js庫的源代碼,我看到諸如函數調用knockout.js庫中的exportProperty函數的用途是什麼?
ko.exportProperty(this, 'subscribe', this.subscribe);
ko.exportProperty(this, 'extend', this.extend);
ko.exportProperty(this, 'getSubscriptionsCount', this.getSubscriptionsCount);
您可以檢查source code in here
和exportProperty
定義是
ko.exportProperty = function(owner, publicName, object) {
owner[publicName] = object;
};
源代碼here。
我想了解它的功能。但是,我瞭解exportProperty的用法不會改變或破壞對象上的任何東西,當我看上去有用時。
你能解釋一下exportProperty函數調用了什麼嗎?
有什麼想法?或者問題不明確? – Freshblood 2012-04-22 16:45:22