OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview Simplified API wrapping native Web Animations with some sugar. | 6 * @fileoverview Simplified API wrapping native Web Animations with some sugar. |
7 * A compromise between the draft spec and Chrome's evolving support. This API | 7 * A compromise between the draft spec and Chrome's evolving support. This API |
8 * will be changed (or removed) as Chrome support evolves. | 8 * will be changed (or removed) as Chrome support evolves. |
9 */ | 9 */ |
10 cr.define('settings.animation', function() { | 10 cr.define('settings.animation', function() { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 // If we were implementing the full spec, we'd have to support | 42 // If we were implementing the full spec, we'd have to support |
43 // removing or resetting these listeners. | 43 // removing or resetting these listeners. |
44 self.animation_.addEventListener('finish', function(e) { | 44 self.animation_.addEventListener('finish', function(e) { |
45 resolve(); | 45 resolve(); |
46 // According to the spec, queue a task to fire the event after | 46 // According to the spec, queue a task to fire the event after |
47 // resolving the promise. | 47 // resolving the promise. |
48 self.queueDispatch_(e); | 48 self.queueDispatch_(e); |
49 }); | 49 }); |
50 self.animation_.addEventListener('cancel', function(e) { | 50 self.animation_.addEventListener('cancel', function(e) { |
51 reject(new | 51 reject(new |
52 /** | 52 /** |
dschuyler
2017/06/16 23:09:07
This looks incorrect (or the lines that follow are
Dan Beam
2017/06/17 00:11:06
this is code is cray to begin with. turned clang-
| |
53 * @see https://heycam.github.io/webidl/#es-DOMException-call | 53 * @see https://heycam.github.io/webidl/#es-DOMException-call |
54 * @type {function (new:DOMException, string, string)} | 54 * @type {function (new:DOMException, string, string)} |
55 */( | 55 */ (DOMException)('', 'AbortError')); |
56 DOMException | |
57 )('', 'AbortError')); | |
58 self.queueDispatch_(e); | 56 self.queueDispatch_(e); |
59 }); | 57 }); |
60 }); | 58 }); |
61 } | 59 } |
62 | 60 |
63 Animation.prototype = { | 61 Animation.prototype = { |
64 __proto__: cr.EventTarget.prototype, | 62 __proto__: cr.EventTarget.prototype, |
65 | 63 |
66 finish: function() { | 64 finish: function() { |
67 assert(this.animation_); | 65 assert(this.animation_); |
(...skipping 15 matching lines...) Expand all Loading... | |
83 this.animation_ = undefined; | 81 this.animation_ = undefined; |
84 }.bind(this)); | 82 }.bind(this)); |
85 }, | 83 }, |
86 }; | 84 }; |
87 | 85 |
88 return { | 86 return { |
89 Animation: Animation, | 87 Animation: Animation, |
90 Timing: Timing, | 88 Timing: Timing, |
91 }; | 89 }; |
92 }); | 90 }); |
OLD | NEW |