Defines a property on the given target which lazily imports a JavaScript
module when accessed.
The first time the property is accessed, the module at the given URL is
imported, and the property is replaced with the module's exported symbol
of the same name.
Some points to note when using this utility:
The cached module export is always stored on the this object that was
used to access the getter. This means that if you define the lazy
getter on a prototype, the module will be re-imported every time the
property is accessed on a new instance.
The getter property may be overwritten by simple assignment, but as
with imports, the new property value is always defined on the this
object that the setter is called with.
If the module import fails, the getter will throw an error, and the
property will not be replaced. Each subsequent attempt to access the
getter will attempt to re-import the object, which will likely continue
to result in errors.
Defines a property on the given target which lazily imports a JavaScript module when accessed.
The first time the property is accessed, the module at the given URL is imported, and the property is replaced with the module's exported symbol of the same name.
Some points to note when using this utility:
The cached module export is always stored on the
this
object that was used to access the getter. This means that if you define the lazy getter on a prototype, the module will be re-imported every time the property is accessed on a new instance.The getter property may be overwritten by simple assignment, but as with imports, the new property value is always defined on the
this
object that the setter is called with.If the module import fails, the getter will throw an error, and the property will not be replaced. Each subsequent attempt to access the getter will attempt to re-import the object, which will likely continue to result in errors.