Naive implementation of Singleton
Methods
-
static create(id, instanceCreator) → {Object}
-
Parameters:
Name Type Description id
String unique id of the instance instanceCreator
function a function that creates the instance Returns:
Object - the instance -
static get(id) → {Object}
-
get the instance by id if exists
Parameters:
Name Type Description id
String unique id of the instance Returns:
Object - the instance -
static remove(id)
-
remove the instance by id
Parameters:
Name Type Description id
String unique id of the instance