Chromium Code Reviews| Index: chrome/browser/resources/settings/animation/transition.js |
| diff --git a/chrome/browser/resources/settings/animation/transition.js b/chrome/browser/resources/settings/animation/transition.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6d562c959e0006dbfdaf43838e9c4ba03ecf1500 |
| --- /dev/null |
| +++ b/chrome/browser/resources/settings/animation/transition.js |
| @@ -0,0 +1,51 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/** |
| + * @fileoverview |
| + * Transitions are cancellable asynchronous state changes. A transition may |
| + * compose web animations and other Transitions to manage a set of animations. |
| + * Similar to Promises, they can initiate tasks after completion or |
| + * cancellation. |
| + */ |
| +cr.define('settings.animation', function() { |
| + 'use strict'; |
| + |
| + /** |
| + * Base class for modular implementations of asynchronous transitions using |
| + * web animations. |
| + * @constructor |
| + */ |
| + function Transition() {} |
| + |
| + Transition.prototype = { |
| + /** |
| + * Starts the transition, including scheduling any animations. |
| + * @return {!Promise} Convenient reference to |finished| for chaining. |
| + */ |
| + play: function() {}, |
|
Dan Beam
2016/07/01 00:33:24
shouldn't this also be assertNotReached() or somet
michaelpg
2016/07/01 20:21:46
Done.
|
| + |
| + /** |
| + * If the transition is still playing, immediately finishes it and resolves |
| + * |finished|. |
| + */ |
| + finish: assertNotReached, |
| + |
| + /** |
| + * If the transition is still playing, immediately cancels it and rejects |
| + * |finished|. |
| + */ |
| + cancel: assertNotReached, |
| + |
| + /** |
| + * Resolved or rejected when the transition is finished or canceled. |
| + * @type {?Promise} |
| + */ |
| + finished: null, |
| + }; |
| + |
| + return { |
| + Transition: Transition, |
| + }; |
| +}); |