What is the purpose of the exportProperty function in the knockout.js library?

I read the source code of the knockout.js library, and I saw such function calls

ko.exportProperty(this, 'subscribe', this.subscribe);
ko.exportProperty(this, 'extend', this.extend);
ko.exportProperty(this, 'getSubscriptionsCount', this.getSubscriptionsCount);

Here you can check the source code.

and exportPropertydefinition

ko.exportProperty = function(owner, publicName, object) {
  owner[publicName] = object;
};

The source code is here .

I am trying to understand what he is doing. But what I understand is, using exportProperty does not change or break anything into an object when I look at usage up.

Can you explain why the exportProperty function is called?

+3
source share
1 answer

Google Closure Compiler, . ko.exportProperty , . , , " API".

+2

All Articles