Socket
Socket
Sign inDemoInstall

stapes

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stapes - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

2

package.json

@@ -7,3 +7,3 @@ {

"keywords": ["mvc", "framework", "lightweight"],
"version": "0.5.0",
"version": "0.5.1",
"repository" : {

@@ -10,0 +10,0 @@ "type" : "git",

@@ -20,3 +20,3 @@ //

var VERSION = "0.5";
var VERSION = "0.5.1";

@@ -181,152 +181,165 @@ // Global counter for all events in all modules (including mixed in objects)

/** Private helper functions */
function addEvent(event) {
// If we don't have any handlers for this type of event, add a new
// array we can use to push new handlers
if (!Stapes._eventHandlers[event.guid][event.type]) {
Stapes._eventHandlers[event.guid][event.type] = [];
}
// Private attributes and helper functions, stored in an object so they
// are overwritable by plugins
var _ = {
// Properties
attributes : {},
// Push an event object
Stapes._eventHandlers[event.guid][event.type].push({
"guid" : event.guid,
"handler" : event.handler,
"scope" : event.scope,
"type" : event.type
});
}
eventHandlers : {
"-1" : {} // '-1' is used for the global event handling
},
function addEventHandler(argTypeOrMap, argHandlerOrScope, argScope) {
var eventMap = {},
scope;
guid : -1,
if (typeof argTypeOrMap === "string") {
scope = argScope || false;
eventMap[ argTypeOrMap ] = argHandlerOrScope;
} else {
scope = argHandlerOrScope || false;
eventMap = argTypeOrMap;
}
// Methods
addEvent : function(event) {
// If we don't have any handlers for this type of event, add a new
// array we can use to push new handlers
if (!_.eventHandlers[event.guid][event.type]) {
_.eventHandlers[event.guid][event.type] = [];
}
util.each(eventMap, function(handler, eventString) {
var events = eventString.split(" ");
// Push an event object
_.eventHandlers[event.guid][event.type].push({
"guid" : event.guid,
"handler" : event.handler,
"scope" : event.scope,
"type" : event.type
});
},
util.each(events, function(eventType) {
addEvent.call(this, {
"guid" : this._guid,
"handler" : handler,
"scope" : scope,
"type" : eventType
});
}, this);
}, this);
}
addEventHandler : function(argTypeOrMap, argHandlerOrScope, argScope) {
var eventMap = {},
scope;
function addGuid(object) {
if (object._guid) return;
if (typeof argTypeOrMap === "string") {
scope = argScope || false;
eventMap[ argTypeOrMap ] = argHandlerOrScope;
} else {
scope = argHandlerOrScope || false;
eventMap = argTypeOrMap;
}
object._guid = guid++;
util.each(eventMap, function(handler, eventString) {
var events = eventString.split(" ");
Stapes._attributes[object._guid] = {};
Stapes._eventHandlers[object._guid] = {};
}
util.each(events, function(eventType) {
_.addEvent.call(this, {
"guid" : this._guid,
"handler" : handler,
"scope" : scope,
"type" : eventType
});
}, this);
}, this);
},
// This is a really small utility function to save typing and produce
// better optimized code
function attr(guid) {
return Stapes._attributes[guid];
}
addGuid : function(object, forceGuid) {
if (object._guid && !forceGuid) return;
// Stapes objects have some extra properties that are set on creation
function createModule( context ) {
var instance = util.create( context );
object._guid = guid++;
addGuid( instance );
_.attributes[object._guid] = {};
_.eventHandlers[object._guid] = {};
},
// Mixin events
Stapes.mixinEvents( instance );
// This is a really small utility function to save typing and produce
// better optimized code
attr : function(guid) {
return _.attributes[guid];
},
return instance;
}
// Stapes objects have some extra properties that are set on creation
createModule : function( context ) {
var instance = util.create( context );
function emitEvents(type, data, explicitType, explicitGuid) {
explicitType = explicitType || false;
explicitGuid = explicitGuid || this._guid;
_.addGuid( instance, true );
util.each(Stapes._eventHandlers[explicitGuid][type], function(event) {
var scope = (event.scope) ? event.scope : this;
if (explicitType) {
event.type = explicitType;
}
event.scope = scope;
event.handler.call(event.scope, data, event);
}, this);
}
// Mixin events
Stapes.mixinEvents( instance );
function removeEventHandler(type, handler) {
var handlers = Stapes._eventHandlers[this._guid];
return instance;
},
if (type && handler) {
// Remove a specific handler
util.each(handlers[type], function(eventObject, index) {
if (eventObject.handler === handler) {
handlers[type].splice(index--, 1);
emitEvents : function(type, data, explicitType, explicitGuid) {
explicitType = explicitType || false;
explicitGuid = explicitGuid || this._guid;
util.each(_.eventHandlers[explicitGuid][type], function(event) {
var scope = (event.scope) ? event.scope : this;
if (explicitType) {
event.type = explicitType;
}
event.scope = scope;
event.handler.call(event.scope, data, event);
}, this);
} else if (type) {
// Remove all handlers for a specific type
delete handlers[type];
} else {
// Remove all handlers for this module
Stapes._eventHandlers[this._guid] = {};
}
}
},
function setAttribute(key, value) {
// We need to do this before we actually add the item :)
var itemExists = this.has(key),
oldValue = attr(this._guid)[key];
removeEventHandler : function(type, handler) {
var handlers = _.eventHandlers[this._guid];
// Is the value different than the oldValue? If not, ignore this call
if (value === oldValue) {
return;
}
if (type && handler) {
// Remove a specific handler
util.each(handlers[type], function(eventObject, index) {
if (eventObject.handler === handler) {
handlers[type].splice(index--, 1);
}
}, this);
} else if (type) {
// Remove all handlers for a specific type
delete handlers[type];
} else {
// Remove all handlers for this module
_.eventHandlers[this._guid] = {};
}
},
// Actually add the item to the attributes
attr(this._guid)[key] = value;
setAttribute : function(key, value) {
// We need to do this before we actually add the item :)
var itemExists = this.has(key),
oldValue = _.attr(this._guid)[key];
// Throw a generic event
this.emit('change', key);
// Is the value different than the oldValue? If not, ignore this call
if (value === oldValue) {
return;
}
// And a namespaced event as well, NOTE that we pass value instead of
// key here!
this.emit('change:' + key, value);
// Actually add the item to the attributes
_.attr(this._guid)[key] = value;
// Throw namespaced and non-namespaced 'mutate' events as well with
// the old value data as well and some extra metadata such as the key
var mutateData = {
"key" : key,
"newValue" : value,
"oldValue" : oldValue || null
};
// Throw a generic event
this.emit('change', key);
this.emit('mutate', mutateData);
this.emit('mutate:' + key, mutateData);
// And a namespaced event as well, NOTE that we pass value instead of
// key here!
this.emit('change:' + key, value);
// Also throw a specific event for this type of set
var specificEvent = itemExists ? 'update' : 'create';
// Throw namespaced and non-namespaced 'mutate' events as well with
// the old value data as well and some extra metadata such as the key
var mutateData = {
"key" : key,
"newValue" : value,
"oldValue" : oldValue || null
};
this.emit(specificEvent, key);
this.emit('mutate', mutateData);
this.emit('mutate:' + key, mutateData);
// And a namespaced event as well, NOTE that we pass value instead of key
this.emit(specificEvent + ':' + key, value);
}
// Also throw a specific event for this type of set
var specificEvent = itemExists ? 'update' : 'create';
function updateAttribute(key, fn) {
var item = this.get(key),
newValue = fn( util.clone(item) );
this.emit(specificEvent, key);
setAttribute.call(this, key, newValue);
}
// And a namespaced event as well, NOTE that we pass value instead of key
this.emit(specificEvent + ':' + key, value);
},
updateAttribute : function(key, fn) {
var item = this.get(key),
newValue = fn( util.clone(item) );
_.setAttribute.call(this, key, newValue);
}
};
// Can be mixed in later using Stapes.mixinEvents(object);

@@ -340,9 +353,9 @@ var Events = {

// global stack?
if (Stapes._eventHandlers[-1].all) {
emitEvents.call(this, "all", data, type, -1);
if (_.eventHandlers[-1].all) {
_.emitEvents.call(this, "all", data, type, -1);
}
// Catch all events for this type?
if (Stapes._eventHandlers[-1][type]) {
emitEvents.call(this, type, data, type, -1);
if (_.eventHandlers[-1][type]) {
_.emitEvents.call(this, type, data, type, -1);
}

@@ -352,9 +365,9 @@

// 'all' event for this specific module?
if (Stapes._eventHandlers[this._guid].all) {
emitEvents.call(this, "all", data, type);
if (_.eventHandlers[this._guid].all) {
_.emitEvents.call(this, "all", data, type);
}
// Finally, normal events :)
if (Stapes._eventHandlers[this._guid][type]) {
emitEvents.call(this, type, data);
if (_.eventHandlers[this._guid][type]) {
_.emitEvents.call(this, type, data);
}

@@ -366,17 +379,17 @@ }

off : function() {
removeEventHandler.apply(this, arguments);
_.removeEventHandler.apply(this, arguments);
},
on : function() {
addEventHandler.apply(this, arguments);
_.addEventHandler.apply(this, arguments);
}
};
var Module = {
_.Module = {
create : function() {
return createModule( this );
return _.createModule( this );
},
each : function(fn, ctx) {
util.each(attr(this._guid), fn, ctx || this);
util.each(_.attr(this._guid), fn, ctx || this);
},

@@ -396,3 +409,3 @@

filter : function(fn) {
return util.filter(attr(this._guid), fn);
return util.filter(_.attr(this._guid), fn);
},

@@ -402,3 +415,3 @@

if (typeof input === "string") {
return this.has(input) ? attr(this._guid)[input] : null;
return this.has(input) ? _.attr(this._guid)[input] : null;
} else if (typeof input === "function") {

@@ -411,7 +424,7 @@ var items = this.filter(input);

getAll : function() {
return util.clone( attr(this._guid) );
return util.clone( _.attr(this._guid) );
},
getAllAsArray : function() {
var arr = util.map(attr(this._guid), function(value, key) {
var arr = util.map(_.attr(this._guid), function(value, key) {
if (util.isObject(value)) {

@@ -428,3 +441,3 @@ value.id = key;

has : function(key) {
return (typeof attr(this._guid)[key] !== "undefined");
return (typeof _.attr(this._guid)[key] !== "undefined");
},

@@ -436,6 +449,6 @@

util.each(input, function(value) {
setAttribute.call(this, util.makeUuid(), value);
_.setAttribute.call(this, util.makeUuid(), value);
}, this);
} else {
setAttribute.call(this, util.makeUuid(), input);
_.setAttribute.call(this, util.makeUuid(), input);
}

@@ -448,3 +461,3 @@ },

if (input(item)) {
delete attr(this._guid)[key];
delete _.attr(this._guid)[key];
this.emit('remove change');

@@ -455,3 +468,3 @@ }

if (this.has(input)) {
delete attr(this._guid)[input];
delete _.attr(this._guid)[input];
this.emit('remove change');

@@ -465,6 +478,6 @@ }

util.each(objOrKey, function(value, key) {
setAttribute.call(this, key, value);
_.setAttribute.call(this, key, value);
}, this);
} else {
setAttribute.call(this, objOrKey, value);
_.setAttribute.call(this, objOrKey, value);
}

@@ -474,3 +487,3 @@ },

size : function() {
return util.size( Stapes._attributes[this._guid] );
return util.size( _.attributes[this._guid] );
},

@@ -480,6 +493,6 @@

if (typeof keyOrFn === "string") {
updateAttribute.call(this, keyOrFn, fn);
_.updateAttribute.call(this, keyOrFn, fn);
} else if (typeof keyOrFn === "function") {
this.each(function(value, key) {
updateAttribute.call(this, key, keyOrFn);
_.updateAttribute.call(this, key, keyOrFn);
});

@@ -491,12 +504,6 @@ }

var Stapes = {
"_attributes" : {},
"_" : _, // private helper functions and properties
"_eventHandlers" : {
"-1" : {} // '-1' is used for the global event handling
},
"_guid" : -1,
"create" : function() {
return createModule( Module );
return _.createModule( _.Module );
},

@@ -506,3 +513,3 @@

util.each(obj, function(value, key) {
Module[key] = value;
_.Module[key] = value;
});

@@ -514,3 +521,3 @@ },

addGuid(obj);
_.addGuid(obj);

@@ -525,3 +532,3 @@ util.each(Events, function(value, key) {

"on" : function() {
addEventHandler.apply(this, arguments);
_.addEventHandler.apply(this, arguments);
},

@@ -528,0 +535,0 @@

@@ -1,2 +0,2 @@

// Stapes.js v0.5 - (c) Hay Kranen, released under the MIT license - http://hay.github.com/stapes
(function(){function l(a,b){var d=this.get(a),e=b(c.clone(d));k.call(this,a,e)}function k(a,b){var c=this.has(a),d=g(this._guid)[a];if(b!==d){g(this._guid)[a]=b,this.emit("change",a),this.emit("change:"+a,b);var e={key:a,newValue:b,oldValue:d||null};this.emit("mutate",e),this.emit("mutate:"+a,e);var f=c?"update":"create";this.emit(f,a),this.emit(f+":"+a,b)}}function j(a,b){var d=o._eventHandlers[this._guid];a&&b?c.each(d[a],function(c,e){c.handler===b&&d[a].splice(e--,1)},this):a?delete d[a]:o._eventHandlers[this._guid]={}}function i(a,b,d,e){d=d||!1,e=e||this._guid,c.each(o._eventHandlers[e][a],function(a){var c=a.scope?a.scope:this;d&&(a.type=d),a.scope=c,a.handler.call(a.scope,b,a)},this)}function h(a){var b=c.create(a);f(b),o.mixinEvents(b);return b}function g(a){return o._attributes[a]}function f(a){a._guid||(a._guid=b++,o._attributes[a._guid]={},o._eventHandlers[a._guid]={})}function e(a,b,e){var f={},g;typeof a=="string"?(g=e||!1,f[a]=b):(g=b||!1,f=a),c.each(f,function(a,b){var e=b.split(" ");c.each(e,function(b){d.call(this,{guid:this._guid,handler:a,scope:g,type:b})},this)},this)}function d(a){o._eventHandlers[a.guid][a.type]||(o._eventHandlers[a.guid][a.type]=[]),o._eventHandlers[a.guid][a.type].push({guid:a.guid,handler:a.handler,scope:a.scope,type:a.type})}"use strict";var a="0.5",b=1,c={bind:function(a,b){if(c.isObject(a)){c.each(a,function(b,d){c.typeOf(b)==="function"&&(a[d]=c.bind(b,a))});return a}return Function.prototype.bind?a.bind(b):function(){return a.apply(b,arguments)}},clone:function(a){if(c.isArray(a))return a.slice();if(c.isObject(a)){var b={};c.each(a,function(a,c){b[c]=a});return b}return a},create:function(a){var b;if(typeof Object.create=="function")b=Object.create(a);else{var c=function(){};c.prototype=a,b=new c}return b},each:function(a,b,d){if(c.isArray(a))if(Array.prototype.forEach)a.forEach(b,d);else for(var e=0,f=a.length;e<f;e++)b.call(d,a[e],e);else for(var g in a)b.call(d,a[g],g)},filter:function(a,b,d){var e=[];if(c.isArray(a)&&Array.prototype.filter)return a.filter(b,d);c.each(a,function(a){b.call(d,a)&&e.push(a)});return e},isArray:function(a){return c.typeOf(a)==="array"},isObject:function(a){return c.typeOf(a)==="object"},keys:function(a){return c.map(a,function(a,b){return b})},makeUuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=Math.random()*16|0,c=a=="x"?b:b&3|8;return c.toString(16)})},map:function(a,b,d){var e=[];if(c.isArray(a)&&Array.prototype.map)return a.map(b,d);c.each(a,function(a,c){e.push(b.call(d,a,c))});return e},size:function(a){return c.isArray(a)?a.length:c.keys(a).length},toArray:function(a){return c.isObject(a)?c.values(a):Array.prototype.slice.call(a,0)},typeOf:function(a){return Object.prototype.toString.call(a).replace(/\[object |\]/g,"").toLowerCase()},values:function(a){return c.map(a,function(a,b){return a})}},m={emit:function(a,b){b=typeof b=="undefined"?null:b,c.each(a.split(" "),function(a){o._eventHandlers[-1].all&&i.call(this,"all",b,a,-1),o._eventHandlers[-1][a]&&i.call(this,a,b,a,-1),typeof this._guid=="number"&&(o._eventHandlers[this._guid].all&&i.call(this,"all",b,a),o._eventHandlers[this._guid][a]&&i.call(this,a,b))},this)},off:function(){j.apply(this,arguments)},on:function(){e.apply(this,arguments)}},n={create:function(){return h(this)},each:function(a,b){c.each(g(this._guid),a,b||this)},extend:function(a,b){var d=b?a:this,e=b?b:a;c.each(e,function(a,b){d[b]=a});return this},filter:function(a){return c.filter(g(this._guid),a)},get:function(a){if(typeof a=="string")return this.has(a)?g(this._guid)[a]:null;if(typeof a=="function"){var b=this.filter(a);return b.length?b[0]:null}},getAll:function(){return c.clone(g(this._guid))},getAllAsArray:function(){var a=c.map(g(this._guid),function(a,b){c.isObject(a)&&(a.id=b);return a});return c.clone(a)},has:function(a){return typeof g(this._guid)[a]!="undefined"},push:function(a){c.isArray(a)?c.each(a,function(a){k.call(this,c.makeUuid(),a)},this):k.call(this,c.makeUuid(),a)},remove:function(a){typeof a=="function"?this.each(function(b,c){a(b)&&(delete g(this._guid)[c],this.emit("remove change"))}):this.has(a)&&(delete g(this._guid)[a],this.emit("remove change"))},set:function(a,b){c.isObject(a)?c.each(a,function(a,b){k.call(this,b,a)},this):k.call(this,a,b)},size:function(){return c.size(o._attributes[this._guid])},update:function(a,b){typeof a=="string"?l.call(this,a,b):typeof a=="function"&&this.each(function(b,c){l.call(this,c,a)})}},o={_attributes:{},_eventHandlers:{"-1":{}},_guid:-1,create:function(){return h(n)},extend:function(a){c.each(a,function(a,b){n[b]=a})},mixinEvents:function(a){a=a||{},f(a),c.each(m,function(b,c){a[c]=b});return a},on:function(){e.apply(this,arguments)},util:c,version:a};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=o),exports.Stapes=o):typeof define=="function"&&define.amd?define(function(){return o}):window.Stapes=o})()
/*! Stapes.js v0.5.1 - (c) Hay Kranen, released under the MIT license - http://hay.github.com/stapes */
(function(){"use strict";var a="0.5.1",b=1,c={bind:function(a,b){if(c.isObject(a)){c.each(a,function(b,d){c.typeOf(b)==="function"&&(a[d]=c.bind(b,a))});return a}return Function.prototype.bind?a.bind(b):function(){return a.apply(b,arguments)}},clone:function(a){if(c.isArray(a))return a.slice();if(c.isObject(a)){var b={};c.each(a,function(a,c){b[c]=a});return b}return a},create:function(a){var b;if(typeof Object.create=="function")b=Object.create(a);else{var c=function(){};c.prototype=a,b=new c}return b},each:function(a,b,d){if(c.isArray(a))if(Array.prototype.forEach)a.forEach(b,d);else for(var e=0,f=a.length;e<f;e++)b.call(d,a[e],e);else for(var g in a)b.call(d,a[g],g)},filter:function(a,b,d){var e=[];if(c.isArray(a)&&Array.prototype.filter)return a.filter(b,d);c.each(a,function(a){b.call(d,a)&&e.push(a)});return e},isArray:function(a){return c.typeOf(a)==="array"},isObject:function(a){return c.typeOf(a)==="object"},keys:function(a){return c.map(a,function(a,b){return b})},makeUuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=Math.random()*16|0,c=a=="x"?b:b&3|8;return c.toString(16)})},map:function(a,b,d){var e=[];if(c.isArray(a)&&Array.prototype.map)return a.map(b,d);c.each(a,function(a,c){e.push(b.call(d,a,c))});return e},size:function(a){return c.isArray(a)?a.length:c.keys(a).length},toArray:function(a){return c.isObject(a)?c.values(a):Array.prototype.slice.call(a,0)},typeOf:function(a){return Object.prototype.toString.call(a).replace(/\[object |\]/g,"").toLowerCase()},values:function(a){return c.map(a,function(a,b){return a})}},d={attributes:{},eventHandlers:{"-1":{}},guid:-1,addEvent:function(a){d.eventHandlers[a.guid][a.type]||(d.eventHandlers[a.guid][a.type]=[]),d.eventHandlers[a.guid][a.type].push({guid:a.guid,handler:a.handler,scope:a.scope,type:a.type})},addEventHandler:function(a,b,e){var f={},g;typeof a=="string"?(g=e||!1,f[a]=b):(g=b||!1,f=a),c.each(f,function(a,b){var e=b.split(" ");c.each(e,function(b){d.addEvent.call(this,{guid:this._guid,handler:a,scope:g,type:b})},this)},this)},addGuid:function(a,c){if(!a._guid||!!c)a._guid=b++,d.attributes[a._guid]={},d.eventHandlers[a._guid]={}},attr:function(a){return d.attributes[a]},createModule:function(a){var b=c.create(a);d.addGuid(b,!0),f.mixinEvents(b);return b},emitEvents:function(a,b,e,f){e=e||!1,f=f||this._guid,c.each(d.eventHandlers[f][a],function(a){var c=a.scope?a.scope:this;e&&(a.type=e),a.scope=c,a.handler.call(a.scope,b,a)},this)},removeEventHandler:function(a,b){var e=d.eventHandlers[this._guid];a&&b?c.each(e[a],function(c,d){c.handler===b&&e[a].splice(d--,1)},this):a?delete e[a]:d.eventHandlers[this._guid]={}},setAttribute:function(a,b){var c=this.has(a),e=d.attr(this._guid)[a];if(b!==e){d.attr(this._guid)[a]=b,this.emit("change",a),this.emit("change:"+a,b);var f={key:a,newValue:b,oldValue:e||null};this.emit("mutate",f),this.emit("mutate:"+a,f);var g=c?"update":"create";this.emit(g,a),this.emit(g+":"+a,b)}},updateAttribute:function(a,b){var e=this.get(a),f=b(c.clone(e));d.setAttribute.call(this,a,f)}},e={emit:function(a,b){b=typeof b=="undefined"?null:b,c.each(a.split(" "),function(a){d.eventHandlers[-1].all&&d.emitEvents.call(this,"all",b,a,-1),d.eventHandlers[-1][a]&&d.emitEvents.call(this,a,b,a,-1),typeof this._guid=="number"&&(d.eventHandlers[this._guid].all&&d.emitEvents.call(this,"all",b,a),d.eventHandlers[this._guid][a]&&d.emitEvents.call(this,a,b))},this)},off:function(){d.removeEventHandler.apply(this,arguments)},on:function(){d.addEventHandler.apply(this,arguments)}};d.Module={create:function(){return d.createModule(this)},each:function(a,b){c.each(d.attr(this._guid),a,b||this)},extend:function(a,b){var d=b?a:this,e=b?b:a;c.each(e,function(a,b){d[b]=a});return this},filter:function(a){return c.filter(d.attr(this._guid),a)},get:function(a){if(typeof a=="string")return this.has(a)?d.attr(this._guid)[a]:null;if(typeof a=="function"){var b=this.filter(a);return b.length?b[0]:null}},getAll:function(){return c.clone(d.attr(this._guid))},getAllAsArray:function(){var a=c.map(d.attr(this._guid),function(a,b){c.isObject(a)&&(a.id=b);return a});return c.clone(a)},has:function(a){return typeof d.attr(this._guid)[a]!="undefined"},push:function(a){c.isArray(a)?c.each(a,function(a){d.setAttribute.call(this,c.makeUuid(),a)},this):d.setAttribute.call(this,c.makeUuid(),a)},remove:function(a){typeof a=="function"?this.each(function(b,c){a(b)&&(delete d.attr(this._guid)[c],this.emit("remove change"))}):this.has(a)&&(delete d.attr(this._guid)[a],this.emit("remove change"))},set:function(a,b){c.isObject(a)?c.each(a,function(a,b){d.setAttribute.call(this,b,a)},this):d.setAttribute.call(this,a,b)},size:function(){return c.size(d.attributes[this._guid])},update:function(a,b){typeof a=="string"?d.updateAttribute.call(this,a,b):typeof a=="function"&&this.each(function(b,c){d.updateAttribute.call(this,c,a)})}};var f={_:d,create:function(){return d.createModule(d.Module)},extend:function(a){c.each(a,function(a,b){d.Module[b]=a})},mixinEvents:function(a){a=a||{},d.addGuid(a),c.each(e,function(b,c){a[c]=b});return a},on:function(){d.addEventHandler.apply(this,arguments)},util:c,version:a};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=f),exports.Stapes=f):typeof define=="function"&&define.amd?define(function(){return f}):window.Stapes=f})()

@@ -181,3 +181,3 @@ var undef;

var events = Stapes._eventHandlers[module._guid];
var events = Stapes._.eventHandlers[module._guid];

@@ -196,3 +196,3 @@ ok(util.size(events) === 2, "Event handlers are set");

ok(util.size(Stapes._eventHandlers[module._guid]) === 0, "no handlers for module");
ok(util.size(Stapes._.eventHandlers[module._guid]) === 0, "no handlers for module");
});

@@ -214,2 +214,9 @@

ok(f._guid !== g._guid, "_guid of two newly created objects should not be the same");
});
test("guid", function() {
var module1 = Stapes.create();
var module2 = module1.create();
ok(module2._guid === (module1._guid + 1), "A new module should increase its guid by 1");
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc