UNPKG

web-atoms-core

Version:
41 lines 1.46 kB
(function (factory) { if (typeof module === "object" && typeof module.exports === "object") { var v = factory(require, exports); if (v !== undefined) module.exports = v; } else if (typeof define === "function" && define.amd) { define(["require", "exports"], factory); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); }); // export class AtomOnceTest extends AtomTest { // private a: AtomOnce = new AtomOnce(); // private isRunning: boolean = false; // @Test // public async promise(): Promise<void> { // await this.runPromise(false); // Assert.isFalse((this.a as any).isRunning); // await this.runPromise(true); // Assert.isFalse((this.a as any).isRunning); // } // private async runPromise(fail: boolean): Promise<void> { // // tslint:disable-next-line: no-debugger // debugger; // if (this.isRunning) { // throw new Error("Already running"); // } // this.isRunning = true; // this.a.run(() => this.run(fail)); // this.isRunning = false; // } // private async run(fail: boolean): Promise<void> { // await Atom.delay(1); // this.a.run(() => this.runPromise(fail)); // if (fail) { // throw new Error("failed"); // } // } // } //# sourceMappingURL=AtomOnceTest.js.map