Labs/Jetpack/Binary Components: Difference between revisions

added docs for more membrane methods
(added more docs for membrane functions)
(added docs for more membrane methods)
Line 23: Line 23:


''membrane'' should be a JavaScript object with any of the following methods defined:
''membrane'' should be a JavaScript object with any of the following methods defined:
::<code>membrane.</code>'''convert'''(''wrappee'', ''membrane'', ''type'')
::This is essentially a JavaScript version of [https://developer.mozilla.org/en/SpiderMonkey/JSAPI_Reference/JSClass.convert JSClass.convert], and is called when SpiderMonkey needs to coerce ''wrappee'' to a different type.  ''type'' is a string identifying the name of the desired type to coerce to, and can be anything ordinarily returned by JavaScript's ''typeof'' operator.  The default implementation of this is to call ''wrappee.''<code>valueOf()</code>.
::'''NOTE:''' Be very careful about implementing this function, as it can easily cause infinite recursion.


::<code>membrane.</code>'''resolve'''(''wrappee'', ''membrane'', ''name'')
::<code>membrane.</code>'''resolve'''(''wrappee'', ''membrane'', ''name'')
Line 47: Line 53:


::This is essentially a JavaScript version of [https://developer.mozilla.org/En/SpiderMonkey/JSAPI_Reference/JSPropertyOp JSClass.delProperty]; alternatively, it could be described as the analog of Python's <code>__delattr__</code> magic method. ''name'' is the name of the property being deleted.  This function should return <code>true</code> if the property can be deleted, and <code>false</code> if not.
::This is essentially a JavaScript version of [https://developer.mozilla.org/En/SpiderMonkey/JSAPI_Reference/JSPropertyOp JSClass.delProperty]; alternatively, it could be described as the analog of Python's <code>__delattr__</code> magic method. ''name'' is the name of the property being deleted.  This function should return <code>true</code> if the property can be deleted, and <code>false</code> if not.


=== unwrap() ===
=== unwrap() ===
93

edits