Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
move listenOnce to core-transition
Browse files Browse the repository at this point in the history
  • Loading branch information
Yvonne Yip committed Jun 6, 2014
1 parent 1240b66 commit 8cab275
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
10 changes: 0 additions & 10 deletions core-transition-css.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,6 @@
});
node.classList.toggle(this.openedClass, opened);
node.classList.toggle(this.closedClass, !opened);
},

// TODO(sorvell): worth promoting
listenOnce: function(node, event, fn, args) {
var self = this;
var listener = function() {
fn.apply(self, args);
node.removeEventListener(event, listener, false);
}
node.addEventListener(event, listener, false);
}

});
Expand Down
10 changes: 9 additions & 1 deletion core-transition.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,16 @@

complete: function(node) {
this.fire('core-transitionend', null, node);
}
},

listenOnce: function(node, event, fn, args) {
var self = this;
var listener = function() {
fn.apply(self, args);
node.removeEventListener(event, listener, false);
}
node.addEventListener(event, listener, false);
}

});
</script>
Expand Down

0 comments on commit 8cab275

Please sign in to comment.