Sha256: 3c31486e3891efc6a4cd65f218f03762b33ed039aa99b18ea81f625bb0b02714

Contents?: true

Size: 397 Bytes

Versions: 5

Compression:

Stored size: 397 Bytes

Contents

slices.HOOKS = {};

/*
 * Register a slices hook function.
 *
 * @param {String} key
 * @param {Function} fun
 */

slices.on = function(key, fun) {
  slices.HOOKS[key] = slices.HOOKS[key] || [];
  slices.HOOKS[key].push(fun);
};

/*
 * Trigger hooks for key.
 *
 * @param {String} key
 */

slices.trigger = function(key) {
  var hooks = slices.HOOKS[key];
  if (hooks) _.invoke(hooks, 'call');
};

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
slices-2.0.2 app/assets/javascripts/slices/app/helpers/hooks.js
slices-2.0.1 app/assets/javascripts/slices/app/helpers/hooks.js
slices-2.0.0 app/assets/javascripts/slices/app/helpers/hooks.js
slices-1.0.5 app/assets/javascripts/slices/app/helpers/hooks.js
slices-1.0.4 app/assets/javascripts/slices/app/helpers/hooks.js