Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Side by Side Diff: chrome/test/data/webui/promise_resolver.js

Issue 1758013002: WebUI: Allow rejecting a promise that is returned from cr.sendWithPromise(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re-rename Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 /**
6 * @fileoverview PromiseResolver is a helper class that allows creating a
7 * Promise that will be fulfilled (resolved or rejected) some time later.
8 *
9 * Example:
10 * var resolver = new PromiseResolver();
11 * resolver.promise.then(function(result) {
12 * console.log('resolved with', result);
13 * });
14 * ...
15 * ...
16 * resolver.resolve({hello: 'world'});
17 */
18
19 /**
20 * @constructor
21 */
22 function PromiseResolver() {
23 /** @type {!Function} */
24 this.resolve;
25
26 /** @type {!Function} */
27 this.reject;
28
29 /** @type {!Promise} */
30 this.promise = new Promise(function(resolve, reject) {
31 this.resolve = resolve;
32 this.reject = reject;
33 }.bind(this));
34 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/settings/site_settings_handler.cc ('k') | chrome/test/data/webui/settings/cr_settings_browsertest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698