-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
But in a basic cache, and a few api methods to hack against
- Loading branch information
1 parent
94d30ef
commit 4217ada
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
var _cache = []; | ||
|
||
function EventHandler(token, eventName, handler, enabled) { | ||
this.elementToken = token; | ||
this.eventName = 'click.namespacename'; | ||
this.eventType = 'click'; | ||
this.namespace = 'namespace'; | ||
this.handler = handler; | ||
this.enabled = enabled; | ||
} | ||
|
||
module.exports = { | ||
add : function(token, eventName, handler) { | ||
_cache[token] = new EventHandler(token, eventName, handler, true); | ||
}, | ||
removeHandler : function(token, handler) { | ||
delete _cache[token]; | ||
}, | ||
getHandlers : function(token, eventName) { | ||
return _cache | ||
.filter(function(entry) { | ||
return entry.elementToken === token && entry.eventName === eventName; | ||
}) | ||
.map(function(h) { | ||
return h.handler; | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
var cache = require('cache'); | ||
var evtAttributeName = '__evt'; | ||
var idCount = 1; | ||
var tree = {}; | ||
|