Adds some sugar and enhancements to @brunschgi's excellent Terrificjs frontend framework
MIT License
Adds some sugar and enhancements to @brunschgi's excellent Terrificjs frontend framework.
Load the file terrific-extensions.js someplace after the Terrific library and before the application bootstrap.
Select elements in the module context.
@param {string} selector
@returns {jQuery}
jQuery collectionthis.$(selector)
deprecated, alias of Tc.Module.prototype.$
Bind methods to Terrific module context. Commonly used on event handler functions. Inspired by Underscore's bindAll.
@param {...string} methods
Names of methods each as a param.@return {module}
Returns the module instance for chaining.this.bindAll(funcName [,funcName...])
Get the name of the Terrific module
@returns {string}
Module namethis.getName()
Simplify connector channel subscription
Simpler subscribe without need for the second parameter to sandbox.subscribe this
which is often forgotten. Additionally this method allows connecting to multiple channels at once.
@param {...string} channels
Connector channels to subscribe to@return {module}
Returns the module instance for chaining.this.subscribe(channelName [,channelName...])
Micro-templating for modules. Extrapolates {{= foo }} variables in strings from data. Much smarter than string concatenation and massively smaller and faster than using a full-blown template engine.
This function is a remix of
This code incorporates a fix for single-quote usage.
@param {string} str
Template@param {object} [data]
Optional, renders template immediately if present. Data to use as the template context for variable extrapolation.@returns {function|string}
Template function, to render template with data, or if data was supplied already the rendered template.this.template(str, data)
npm install
Installs test dependenciesnpm test
Run JSHint