Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* README

  • Loading branch information...
commit 757eeb435d073809d54baf5242a17eff396bda7d 1 parent 7cd80db
@termi termi authored
Showing with 24 additions and 3 deletions.
  1. +24 −3 README.md
View
27 README.md
@@ -10,16 +10,37 @@ It coudth be found in https://gist.github.com/2369850
//Filtering by class
document.addEventListener("click", new DelegateListener(".player", callback))
//Filtering by attribute value
-document.addEventListener("click", new DelegateListener({"data-event" : "click"}, callback))
+document.addEventListener("click", DelegateListener({"data-event" : "click"}, callback))
//Filtering by attribute exists
-document.addEventListener("click", new DelegateListener({"data-is-menu" : void 0}, callback))
+document.addEventListener("click", DelegateListener({"data-is-menu" : void 0}, callback))
//Filtering by custom filter
-document.addEventListener("click", new DelegateListener(
+document.addEventListener("click", DelegateListener(
function(node) {
return node.contains(someOtherNode);
},
callback)
)
+
+//Using filter instead of callback
+var editorController = {
+ copy : function() {},
+ past : function() {},
+ handler : function(node) {
+ swicth(node.getAttrubute("data-menu-event")) {
+ case "copy":
+ this.copy();
+ breal;
+ case "past":
+ this.copy();
+ breal;
+ return false;
+ }
+ }
+}
+
+document.addEventListener("click", DelegateListener(
+ editorController.handler.bind(editorController)
+));
```
## Licence
Please sign in to comment.
Something went wrong with that request. Please try again.