Skip to content

Example: DynamicObject

Craig Minihan edited this page Apr 23, 2015 · 14 revisions

DynamicObject implements a truly dynamic object instance which you can expose to JavaScript. The properties of the object do not need to be known in advance. For example:

   alert(msg.text);

If the msg object was a libjsapi DynamicObject then the reference to the text field would be routed to the GetCallback supplied in the object Create() call. In the get call you can return any value you like to SpiderMonkey including undefined, null or the classic "hello world".

Clone this wiki locally