eventcache
Advanced tools
Comparing version 0.0.3 to 0.0.4
/** | ||
* eventcache v0.0.2 build 16.07.2015 | ||
* eventcache v0.0.4 build 01.08.2015 | ||
* https://github.com/vanruesc/eventcache | ||
@@ -10,2 +10,27 @@ * Copyright 2015 Raoul van Rueschen, Zlib | ||
/** | ||
* The Event Cache class is a compilation of | ||
* static functions with isolated data structures. | ||
* | ||
* @class EventCache | ||
* @static | ||
*/ | ||
module.exports = { | ||
createCache: createCache, | ||
bind: bind, | ||
unbind: unbind, | ||
flush: flush, | ||
status: status | ||
}; | ||
/** | ||
* The caches. | ||
* | ||
* @property caches | ||
* @type Array | ||
* @private | ||
* @static | ||
*/ | ||
var caches = [[]]; | ||
@@ -16,2 +41,5 @@ | ||
* | ||
* @method extractSignature | ||
* @private | ||
* @static | ||
* @param {Object} args - The original arguments array from a call to add or remove. | ||
@@ -50,3 +78,4 @@ * @return {Array} The event signature. | ||
* | ||
* @return {number} The index of the newly created cache. | ||
* @method createCache | ||
* @return {Number} The index of the newly created cache. | ||
*/ | ||
@@ -59,6 +88,8 @@ | ||
* | ||
* @method bind | ||
* @static | ||
* @param {Object} obj - The object. | ||
* @param {string} event - The event name. | ||
* @param {function} listener - The listener. | ||
* @param {number=} cache - The cache. | ||
* @param {String} event - The event name. | ||
* @param {Function} listener - The listener. | ||
* @param {Number} [cache=0] - The cache. | ||
*/ | ||
@@ -91,6 +122,8 @@ | ||
* | ||
* @method unbind | ||
* @static | ||
* @param {Object} obj - The object. | ||
* @param {string} event - The event name. | ||
* @param {function} listener - The listener. | ||
* @param {number=} cache - The cache. | ||
* @param {String} event - The event name. | ||
* @param {Function} listener - The listener. | ||
* @param {Number} [cache=0] - The cache. | ||
*/ | ||
@@ -136,3 +169,5 @@ | ||
* | ||
* @param {number=} cache - The index of the cache to flush. If not provided, all caches will be flushed. | ||
* @method flush | ||
* @static | ||
* @param {Number} [cache] - The index of the cache to flush. If not provided, all caches will be flushed. | ||
*/ | ||
@@ -170,4 +205,6 @@ | ||
/** | ||
* Provides some insight for debugging. | ||
* Provides insight into the internals. | ||
* | ||
* @method status | ||
* @static | ||
* @return {Object} The default cache and all additional caches. | ||
@@ -184,11 +221,3 @@ */ | ||
module.exports = { | ||
createCache: createCache, | ||
bind: bind, | ||
unbind: unbind, | ||
flush: flush, | ||
status: status | ||
}; | ||
},{}]},{},[1])(1) | ||
}); |
/** | ||
* eventcache v0.0.2 build 16.07.2015 | ||
* eventcache v0.0.4 build 01.08.2015 | ||
* https://github.com/vanruesc/eventcache | ||
* Copyright 2015 Raoul van Rueschen, Zlib | ||
*/ | ||
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.EventCache=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){"use strict";function d(a){var b=[null,null,null,null];if(!a.length||!(a.length>=3||a[0].length>=3))throw new Error("Invalid arguments.");if(1===a.length&&(a=a[0]),b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=4===a.length?a[3]:0,b[3]<0||b[3]>=j.length)throw new Error("The given cache index is out of bounds.");return b}function e(){return j.push([])-1}function f(){var a=d(arguments),b=a[0],c=a[1],e=a[2],f=a[3];return b.addEventListener?b.addEventListener(c,e,!1):b.attachEvent?b.attachEvent("on"+c,e):b["on"+c]=e,j[f].push(a),a}function g(){var a,b=d(arguments),c=b[0],e=b[1],f=b[2],g=b[3];for(a=j[g].length-1;a>=0;--a)b=j[g][a],b[0]===c&&b[1]===e&&b[2]===f&&(c.removeEventListener?c.removeEventListener(e,f,!1):c.detachEvent?c.detachEvent("on"+e,f):c["on"+e]=null,j[g].splice(a,1),a=0)}function h(a){var b,c,d,e=!1;for("number"!=typeof a||isNaN(a)?(a=0,c=j.length,e=!0):(0>a?a=0:a>=j.length&&(a=j.length-1),c=a+1),b=a;c>b;++b)for(d=j[b].length-1;d>=0;--d)g(j[b][d]);e&&(j.length=1)}function i(){return{defaultCache:j.slice(0,1),additionalCaches:j.slice(1)}}var j=[[]];b.exports={createCache:e,bind:f,unbind:g,flush:h,status:i}},{}]},{},[1])(1)}); | ||
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.EventCache=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){"use strict";function d(a){var b=[null,null,null,null];if(!a.length||!(a.length>=3||a[0].length>=3))throw new Error("Invalid arguments.");if(1===a.length&&(a=a[0]),b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=4===a.length?a[3]:0,b[3]<0||b[3]>=j.length)throw new Error("The given cache index is out of bounds.");return b}function e(){return j.push([])-1}function f(){var a=d(arguments),b=a[0],c=a[1],e=a[2],f=a[3];return b.addEventListener?b.addEventListener(c,e,!1):b.attachEvent?b.attachEvent("on"+c,e):b["on"+c]=e,j[f].push(a),a}function g(){var a,b=d(arguments),c=b[0],e=b[1],f=b[2],g=b[3];for(a=j[g].length-1;a>=0;--a)b=j[g][a],b[0]===c&&b[1]===e&&b[2]===f&&(c.removeEventListener?c.removeEventListener(e,f,!1):c.detachEvent?c.detachEvent("on"+e,f):c["on"+e]=null,j[g].splice(a,1),a=0)}function h(a){var b,c,d,e=!1;for("number"!=typeof a||isNaN(a)?(a=0,c=j.length,e=!0):(0>a?a=0:a>=j.length&&(a=j.length-1),c=a+1),b=a;c>b;++b)for(d=j[b].length-1;d>=0;--d)g(j[b][d]);e&&(j.length=1)}function i(){return{defaultCache:j.slice(0,1),additionalCaches:j.slice(1)}}b.exports={createCache:e,bind:f,unbind:g,flush:h,status:i};var j=[[]]},{}]},{},[1])(1)}); |
@@ -57,2 +57,15 @@ "use strict"; | ||
yuidoc: { | ||
compile: { | ||
name: "<%= pkg.name %>", | ||
description: "<%= pkg.description %>", | ||
version: "<%= pkg.version %>", | ||
url: "<%= pkg.homepage %>", | ||
options: { | ||
paths: ["./src/"], | ||
outdir: "docs" | ||
} | ||
} | ||
}, | ||
watch: { | ||
@@ -80,2 +93,3 @@ gruntfile: { | ||
grunt.loadNpmTasks("grunt-contrib-watch"); | ||
grunt.loadNpmTasks("grunt-contrib-yuidoc"); | ||
@@ -82,0 +96,0 @@ // Task definitions. |
{ | ||
"name": "eventcache", | ||
"description": "This small module aims to simplify the binding and unbinding of event listeners by creating distinct event caches.", | ||
"keywords": ["event", "listener", "cache"], | ||
"version": "0.0.3", | ||
"keywords": [ | ||
"event", | ||
"listener", | ||
"cache" | ||
], | ||
"version": "0.0.4", | ||
"homepage": "https://github.com/vanruesc/eventcache", | ||
@@ -36,4 +40,5 @@ "author": { | ||
"grunt-contrib-uglify": "0.9.x", | ||
"grunt-contrib-watch": "0.6.x" | ||
"grunt-contrib-watch": "0.6.x", | ||
"grunt-contrib-yuidoc": "0.8.x" | ||
} | ||
} |
"use strict"; | ||
/** | ||
* The Event Cache class is a compilation of | ||
* static functions with isolated data structures. | ||
* | ||
* @class EventCache | ||
* @static | ||
*/ | ||
module.exports = { | ||
createCache: createCache, | ||
bind: bind, | ||
unbind: unbind, | ||
flush: flush, | ||
status: status | ||
}; | ||
/** | ||
* The caches. | ||
* | ||
* @property caches | ||
* @type Array | ||
* @private | ||
* @static | ||
*/ | ||
var caches = [[]]; | ||
@@ -8,2 +33,5 @@ | ||
* | ||
* @method extractSignature | ||
* @private | ||
* @static | ||
* @param {Object} args - The original arguments array from a call to add or remove. | ||
@@ -42,3 +70,4 @@ * @return {Array} The event signature. | ||
* | ||
* @return {number} The index of the newly created cache. | ||
* @method createCache | ||
* @return {Number} The index of the newly created cache. | ||
*/ | ||
@@ -51,6 +80,8 @@ | ||
* | ||
* @method bind | ||
* @static | ||
* @param {Object} obj - The object. | ||
* @param {string} event - The event name. | ||
* @param {function} listener - The listener. | ||
* @param {number=} cache - The cache. | ||
* @param {String} event - The event name. | ||
* @param {Function} listener - The listener. | ||
* @param {Number} [cache=0] - The cache. | ||
*/ | ||
@@ -83,6 +114,8 @@ | ||
* | ||
* @method unbind | ||
* @static | ||
* @param {Object} obj - The object. | ||
* @param {string} event - The event name. | ||
* @param {function} listener - The listener. | ||
* @param {number=} cache - The cache. | ||
* @param {String} event - The event name. | ||
* @param {Function} listener - The listener. | ||
* @param {Number} [cache=0] - The cache. | ||
*/ | ||
@@ -128,3 +161,5 @@ | ||
* | ||
* @param {number=} cache - The index of the cache to flush. If not provided, all caches will be flushed. | ||
* @method flush | ||
* @static | ||
* @param {Number} [cache] - The index of the cache to flush. If not provided, all caches will be flushed. | ||
*/ | ||
@@ -162,4 +197,6 @@ | ||
/** | ||
* Provides some insight for debugging. | ||
* Provides insight into the internals. | ||
* | ||
* @method status | ||
* @static | ||
* @return {Object} The default cache and all additional caches. | ||
@@ -175,9 +212,1 @@ */ | ||
} | ||
module.exports = { | ||
createCache: createCache, | ||
bind: bind, | ||
unbind: unbind, | ||
flush: flush, | ||
status: status | ||
}; |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
158689
36
1997
10
1
1