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

Unified Diff: ui/webui/resources/js/promise_resolver.js

Issue 1871043004: Make PromiseResolver's members read-only (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: base off of https://codereview.chromium.org/1869883003/ Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/webui/resources/js/compiled_resources2.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/js/promise_resolver.js
diff --git a/ui/webui/resources/js/promise_resolver.js b/ui/webui/resources/js/promise_resolver.js
index 0759c955584cc18ca2808ea9ad6bd4c64f2fa49c..ba84ada0df798fe96e4cb7f81f44f854d6d478a3 100644
--- a/ui/webui/resources/js/promise_resolver.js
+++ b/ui/webui/resources/js/promise_resolver.js
@@ -21,15 +21,29 @@
* @template T
*/
function PromiseResolver() {
- /** @type {function(T): void} */
- this.resolve;
+ /** @private {function(T): void} */
+ this.resolve_;
- /** @type {function(*=): void} */
- this.reject;
+ /** @private {function(*=): void} */
+ this.reject_;
- /** @type {!Promise<T>} */
- this.promise = new Promise(function(resolve, reject) {
- this.resolve = resolve;
- this.reject = reject;
+ /** @private {!Promise<T>} */
+ this.promise_ = new Promise(function(resolve, reject) {
+ this.resolve_ = resolve;
+ this.reject_ = reject;
}.bind(this));
}
+
+PromiseResolver.prototype = {
+ /** @return {!Promise<T>} */
+ get promise() { return this.promise_; },
+ set promise(p) { assertNotReached(); },
+
+ /** @return {function(T): void} */
+ get resolve() { return this.resolve_; },
+ set resolve(r) { assertNotReached(); },
+
+ /** @return {function(*=): void} */
+ get reject() { return this.reject_; },
+ set reject(s) { assertNotReached(); },
+};
« no previous file with comments | « ui/webui/resources/js/compiled_resources2.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698