Namespace util.helpers
Various utility functions that don't have anywhere else to go.
Defined in: <js/util/helpers.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
<static> |
util.helpers.deepCopy(obj)
Clones an object.
|
<static> |
util.helpers.error(error, req)
Display a whole-page error message to the user by calling either views.leagueError or views.globalError as appropriate.
|
<static> |
util.helpers.resetG()
Delete all the things from the global variable g that are not stored in league databases.
|
Method Detail
<static>
util.helpers.deepCopy(obj)
Clones an object.
Taken from http://stackoverflow.com/a/3284324/786644
- Parameters:
- {Object} obj
- Object to be cloned.
<static>
util.helpers.error(error, req)
Display a whole-page error message to the user by calling either views.leagueError or views.globalError as appropriate.
- Parameters:
- {string} error
- Text of the error message to be displayed.
- {Object} req
- Optional Davis.js request object, containing the callback function and any other metadata
<static>
util.helpers.resetG()
Delete all the things from the global variable g that are not stored in league databases.
This is used to clear out values from other leagues, to ensure that the appropriate values are updated in the database when calling db.setGameAttributes.