From 02cac2b8a6d8d049d87d07a85ad2b371b492d9d7 Mon Sep 17 00:00:00 2001 From: Brian Kim Date: Mon, 2 Sep 2019 23:19:14 -0400 Subject: [PATCH] reorder binding functions in stop vs setting prototype --- packages/repeater/src/repeater.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/repeater/src/repeater.ts b/packages/repeater/src/repeater.ts index b1586c8..efa8e9c 100644 --- a/packages/repeater/src/repeater.ts +++ b/packages/repeater/src/repeater.ts @@ -102,15 +102,15 @@ class RepeaterController { const push: Push = this.push.bind(this); const stop: Stop = this.stop.bind(this) as Stop; const stopP = new Promise((onstop) => (this.onstop = onstop)); - stop.then = stopP.then.bind(stopP); - stop.catch = stopP.catch.bind(stopP); - stop.finally = stopP.finally.bind(stopP); if (typeof Object.setPrototypeOf === "function") { Object.setPrototypeOf(stop, Promise.prototype); } else { (this as any).__proto__ = Promise.prototype; } + stop.then = stopP.then.bind(stopP); + stop.catch = stopP.catch.bind(stopP); + stop.finally = stopP.finally.bind(stopP); // Errors which occur in the executor take precedence over those passed to // this.stop, so calling this.stop with the caught error would be redundant. try {