-
Robert Knight authored
Previously a heuristic based on function naming was used to determine whether `Injector` should construct objects with `new` or not. This is brittle because compiler transforms may alter function names (eg. terser removes them by default). This commit re-works the API so that the caller explicitly indicates how the object should be created (the "provider" to use). As a convenience if a function is passed it is assumed to be a class. ``` // Register a class. register("anObject", SomeClass); register("anObject", { class: SomeClass }); // Register a factory. register("anObject", { factory: makeMeAnObject }); // Register a plain value. register("anObject", { value: "foobar" }); ```
947a2acc
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
polyfills | ||
test | ||
bridge-events.js | ||
bridge.js | ||
discovery.js | ||
frame-rpc.js | ||
injector.js | ||
settings.js | ||
warn-once.js |