Simplified event module, added event module documentation

This commit is contained in:
Timothy Warren 2011-06-15 08:33:16 -04:00
parent 15d1d3d4ac
commit a41e850db9
2 changed files with 18 additions and 6 deletions

View File

@ -44,7 +44,7 @@ Browser support: IE8+, Latest versions of Firefox, Chrome, Safari, Opera
**Store**: localstorage wrapper with automatic data serialization **Store**: localstorage wrapper with automatic data serialization
functions functions:
* Get: * Get:
Use: Use:
@ -57,6 +57,19 @@ Browser support: IE8+, Latest versions of Firefox, Chrome, Safari, Opera
* getALL: Retreives all localstorage data in raw form * getALL: Retreives all localstorage data in raw form
Use: Use:
$_.store.getAll(); $_.store.getAll();
**Event**: wrapper for applying events to DOM objects
function:
*Add:
Use:
$_.event.add(selector, event, callback);
*Remove
Use:
$_.event.remove(selector, event, callback);

9
kis.js
View File

@ -76,8 +76,8 @@
for (var name in data) for (var name in data)
{ {
if(!data.hasOwnProperty(name)) continue; if(!data.hasOwnProperty(name)){ continue };
if(typeof data[name] === "function") continue; if(typeof data[name] === "function"){ continue };
var value = data[name].toString(); var value = data[name].toString();
@ -242,13 +242,12 @@
*/ */
(function(){ (function(){
var attach, remove; var attach, remove;
var eType = (document.addEventListener) ? "good" : "bad";
if(eType === "good") if(document.addEventListener)
{ {
attach = function(sel, event, callback) attach = function(sel, event, callback)
{ {
sel.addEventListener(event, callback, false) sel.addEventListener(event, callback, false);
}; };
remove = function(sel, event, callback) remove = function(sel, event, callback)