@@ -26,8 +26,9 @@ will generate a JavaScript wrapper class file roughly like this:
2626
2727``` js
2828const conversions = require (" webidl-conversions" );
29- const impl = require (" ./utils.js" ).implSymbol ;
30- const ctorRegistry = require (" ./utils.js" ).ctorRegistrySymbol ;
29+ const utils = require (" ./utils.js" );
30+
31+ const { implSymbol , ctorRegistrySymbol } = utils;
3132
3233const Impl = require (" ./SomeInterface-impl.js" ).implementation ;
3334
@@ -56,7 +57,7 @@ class SomeInterface {
5657 context: " Failed to execute 'add' on 'SomeInterface': parameter 2"
5758 });
5859
59- return this [impl ].add (... args);
60+ return this [implSymbol ].add (... args);
6061 }
6162}
6263
@@ -66,13 +67,13 @@ Object.defineProperties(SomeInterface.prototype, {
6667});
6768
6869exports .create = (globalObject , constructorArgs = [], privateData = {}) => {
69- const ctor = globalObject[ctorRegistry ].SomeInterface ;
70+ const ctor = globalObject[ctorRegistrySymbol ].SomeInterface ;
7071 const obj = Object .create (ctor .prototype );
71- obj[impl ] = new Impl (constructorArgs, privateData);
72+ obj[implSymbol ] = new Impl (constructorArgs, privateData);
7273 return obj;
7374};
7475
75- exports .is = obj => obj && obj[impl ] instanceof Impl;
76+ exports .is = obj => obj && obj[implSymbol ] instanceof Impl;
7677```
7778
7879The above is a simplification of the actual generated code, but should give you some idea of what's going on. We bring your attention to a few points:
0 commit comments