@@ -26,8 +26,9 @@ will generate a JavaScript wrapper class file roughly like this:
26
26
27
27
``` js
28
28
const 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;
31
32
32
33
const Impl = require (" ./SomeInterface-impl.js" ).implementation ;
33
34
@@ -56,7 +57,7 @@ class SomeInterface {
56
57
context: " Failed to execute 'add' on 'SomeInterface': parameter 2"
57
58
});
58
59
59
- return this [impl ].add (... args);
60
+ return this [implSymbol ].add (... args);
60
61
}
61
62
}
62
63
@@ -66,13 +67,13 @@ Object.defineProperties(SomeInterface.prototype, {
66
67
});
67
68
68
69
exports .create = (globalObject , constructorArgs = [], privateData = {}) => {
69
- const ctor = globalObject[ctorRegistry ].SomeInterface ;
70
+ const ctor = globalObject[ctorRegistrySymbol ].SomeInterface ;
70
71
const obj = Object .create (ctor .prototype );
71
- obj[impl ] = new Impl (constructorArgs, privateData);
72
+ obj[implSymbol ] = new Impl (constructorArgs, privateData);
72
73
return obj;
73
74
};
74
75
75
- exports .is = obj => obj && obj[impl ] instanceof Impl;
76
+ exports .is = obj => obj && obj[implSymbol ] instanceof Impl;
76
77
```
77
78
78
79
The 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