| OLD | NEW |
| (Empty) |
| 1 | |
| 2 Polymer('core-transition', { | |
| 3 | |
| 4 type: 'transition', | |
| 5 | |
| 6 /** | |
| 7 * Run the animation. | |
| 8 * | |
| 9 * @method go | |
| 10 * @param {Node} node The node to apply the animation on | |
| 11 * @param {Object} state State info | |
| 12 */ | |
| 13 go: function(node, state) { | |
| 14 this.complete(node); | |
| 15 }, | |
| 16 | |
| 17 /** | |
| 18 * Set up the animation. This may include injecting a stylesheet, | |
| 19 * applying styles, creating a web animations object, etc.. This | |
| 20 * | |
| 21 * @method setup | |
| 22 * @param {Node} node The animated node | |
| 23 */ | |
| 24 setup: function(node) { | |
| 25 }, | |
| 26 | |
| 27 /** | |
| 28 * Tear down the animation. | |
| 29 * | |
| 30 * @method teardown | |
| 31 * @param {Node} node The animated node | |
| 32 */ | |
| 33 teardown: function(node) { | |
| 34 }, | |
| 35 | |
| 36 /** | |
| 37 * Called when the animation completes. This function also fires the | |
| 38 * `core-transitionend` event. | |
| 39 * | |
| 40 * @method complete | |
| 41 * @param {Node} node The animated node | |
| 42 */ | |
| 43 complete: function(node) { | |
| 44 this.fire('core-transitionend', null, node); | |
| 45 }, | |
| 46 | |
| 47 /** | |
| 48 * Utility function to listen to an event on a node once. | |
| 49 * | |
| 50 * @method listenOnce | |
| 51 * @param {Node} node The animated node | |
| 52 * @param {string} event Name of an event | |
| 53 * @param {Function} fn Event handler | |
| 54 * @param {Array} args Additional arguments to pass to `fn` | |
| 55 */ | |
| 56 listenOnce: function(node, event, fn, args) { | |
| 57 var self = this; | |
| 58 var listener = function() { | |
| 59 fn.apply(self, args); | |
| 60 node.removeEventListener(event, listener, false); | |
| 61 } | |
| 62 node.addEventListener(event, listener, false); | |
| 63 } | |
| 64 | |
| 65 }); | |
| 66 | |
| OLD | NEW |