Class Index | File Index

Classes


Namespace Utils


Defined in: Utils.js.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
Some utility functions, primarily around cooperating between node / browser and throwing errors.
Method Summary
Method Attributes Method Name and Description
<static>  
Utils.error(message)
Throws an Error with the provided message.
<static>  
Utils.extendModule(subclass, modulePath, protoMethods)
Extends one class with another using Object.create.
<static>  
Utils.interpolate(str)
Takes a string and interpolates the other arguments.
<static>  
Utils.publisher(module)
Either exports something to the global namespace or makes it available for use from a node require.
Namespace Detail
Utils
Some utility functions, primarily around cooperating between node / browser and throwing errors.
Method Detail
<static> Utils.error(message)
Throws an Error with the provided message. Will also interpolate the message with any additional parameters provided.
Parameters:
message
{string} the message of the thrown error.

<static> Utils.extendModule(subclass, modulePath, protoMethods)
Extends one class with another using Object.create.

The superclass is taken as a string to the module so that if (in the browser) the superclass is lower down in the concatenated file, then we can defer the extending operation until the superclass has been included too. This is unnecessary in nodejs.

Parameters:
subclass
modulePath
protoMethods

<static> {string} Utils.interpolate(str)
Takes a string and interpolates the other arguments.

The format expected for the string is that {0} indicates the first thing to be interpolated, {1} the second, etc.

Will interpolate something into potentially many places in the string.

		interpolate("{0} world", "hello") == "hello world";
Parameters:
{string} str
The string into which values should be interpolated. If null will return null.
Returns:
{string} the string with values replaced.

<static> Utils.publisher(module)
Either exports something to the global namespace or makes it available for use from a node require. You have to use it like this to avoid type errors: Utils.publish(typeof module != 'undefined' ? module : undefined, "ThingToExport", ThingToExport);
Parameters:
module

Documentation generated by JsDoc Toolkit 2.4.0 on Thu Oct 19 2017 06:55:56 GMT+0000 (UTC)