- Source:
Methods
-
getSingletonInstance(context, className)
-
Use this method from your extended object. this.factory is injected into your object. this.factory.getSingletonInstance(this.context, 'VideoModel') will return the video model for use in the extended object.
Parameters:
Name Type Description context
Object injected into extended object as this.context
className
string string name found in all dash.js objects with name __dashjs_factory_name Will be at the bottom. Will be the same as the object's name.
- Source:
Returns:
Context aware instance of specified singleton name.
- Type
- *
-
setSingletonInstance(context, className, instance)
-
Use this method to add an singleton instance to the system. Useful for unit testing to mock objects etc.
Parameters:
Name Type Description context
Object className
string instance
Object - Source: