atom¶
Methods¶
- ¶
o Arguments - mod (Module) – The module whose context the resulting function should execute in. This is used to determine whether “main” should be executed if the returned function’s “main” property is used to construct an object and to aid in resolving the objects “type”.
Return type ObjectInstantiationFunctions
Description A factory function that returns an instantiation function o
whereo.main
is used to execute the “main” handler if in the appropriate context (whererequire.main
==module
)
- ¶
ObjectInstantiationFunctionMain Arguments - datum (Object) – An object whose properties are used to initialize the instance. Note, this object may have it’s type embedded using the “_type” property. In this case the “type” parameter can be omitted.
- type (Object | function | string) – The type of the object being instantiated. This can be an object, a constructor function, or a string. if it is an object, the new object’s prototype will be updated to reflect this. If it is a constructor function,
util.inherits
will be called and constructors will be chained upon instantiation. Finally, if it is a string, “@carbon-io/bond” will be used to “reslove” the type, which should be an object or constructor function. - arg (...*) – Arguments to be passed to the object’s
_init
method
Return type Object Description The “main” variant of ObjectInstantiationFunction
. Use this if you want to invoke “main” after the object has been instantiated in the context ofrequire.main
.
- ¶
ObjectInstantionFunction Arguments - datum (Object) – An object whose properties are used to initialize the instance. Note, this object may have it’s type embedded using the “_type” property. In this case the “type” parameter can be omitted.
- type (Object | function | string) – The type of the object being instantiated. This can be an object, a constructor function, or a string. if it is an object, the new object’s prototype will be updated to reflect this. If it is a constructor function,
util.inherits
will be called and constructors will be chained upon instantiation. Finally, if it is a string, “@carbon-io/bond” will be used to “reslove” the type, which should be an object or constructor function. - arg (...*) – Arguments to be passed to the object’s
_init
method
Return type Object Description Instantiates an object
Typedef: ObjectInstantiationFunctions