From 54ef8e68133a691bdc1cb4d310c0cc39138edbd6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 10 May 2026 17:10:27 +0000 Subject: [PATCH 1/3] Initial plan From 7a749aa77c61f9670468d26ff219ec681455196c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 10 May 2026 17:28:44 +0000 Subject: [PATCH 2/3] feat: add funding metadata to published package manifests Agent-Logs-Url: https://github.com/nevware21/ts-async/sessions/709e723a-2996-4c01-983d-d8d83a9bf416 Co-authored-by: nev21 <82737406+nev21@users.noreply.github.com> --- lib/package.json | 11 ++++- lib/src/promise/base.ts | 64 +++++++++++++++--------------- lib/src/promise/debug.ts | 10 ++--- lib/src/promise/nativePromise.ts | 12 +++--- lib/src/scheduler/taskScheduler.ts | 12 +++--- package.json | 10 +++++ 6 files changed, 69 insertions(+), 50 deletions(-) diff --git a/lib/package.json b/lib/package.json index 8db8eef..094e43c 100644 --- a/lib/package.json +++ b/lib/package.json @@ -3,6 +3,16 @@ "description": "support for asynchronous development with a Promise based task Scheduler, several different Promise implementations (synchronous, idle, asynchronous and native runtime wrappers), await helpers, and aliases all built and tested using TypeScript.", "version": "0.5.5", "homepage": "https://github.com/nevware21/ts-async", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/nevware21" + }, + { + "type": "buymeacoffee", + "url": "https://www.buymeacoffee.com/nevware21" + } + ], "sideEffects": false, "license": "MIT", "author": { @@ -114,4 +124,3 @@ } } - diff --git a/lib/src/promise/base.ts b/lib/src/promise/base.ts index ec26e69..a87e0a9 100644 --- a/lib/src/promise/base.ts +++ b/lib/src/promise/base.ts @@ -25,7 +25,7 @@ import { REJECTED, STR_PROMISE } from "../internal/constants"; import { IPromiseResult } from "../interfaces/IPromiseResult"; //#ifdef DEBUG -import { _debugLog } from "./debug"; +//#:(!DEBUG) import { _debugLog } from "./debug"; //#endif const NODE_UNHANDLED_REJECTION = "unhandledRejection"; @@ -62,16 +62,16 @@ function dumpFnObj(value: any) { } //#ifdef DEBUG -function _getCaller(prefix: string, start: number) { - let stack = new Error().stack; - if (stack) { - let lines = stack.split("\n"); - if (lines.length > start) { - return prefix + ":" + arrSlice(lines, start, start + 5).join("\n") + "\n..."; - } - } - return null; -} +//#:(!DEBUG) function _getCaller(prefix: string, start: number) { +//#:(!DEBUG) let stack = new Error().stack; +//#:(!DEBUG) if (stack) { +//#:(!DEBUG) let lines = stack.split("\n"); +//#:(!DEBUG) if (lines.length > start) { +//#:(!DEBUG) return prefix + ":" + arrSlice(lines, start, start + 5).join("\n") + "\n..."; +//#:(!DEBUG) } +//#:(!DEBUG) } +//#:(!DEBUG) return null; +//#:(!DEBUG) } //#endif /*#__NO_SIDE_EFFECTS__*/ @@ -129,7 +129,7 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi let thenPromise = newPromise(function (resolve, reject) { //#ifdef DEBUG - _debugLog(_toString(), _getCaller("_then", 7)); + //#:(!DEBUG) _debugLog(_toString(), _getCaller("_then", 7)); //#endif // Queue the new promise returned to be resolved or rejected @@ -142,12 +142,12 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi // of this promise. If the corresponding `handler` does not exist, simply // pass through the settled value. //#ifdef DEBUG - _debugLog(_toString(), "Handling settled value " + dumpFnObj(_settledValue)); + //#:(!DEBUG) _debugLog(_toString(), "Handling settled value " + dumpFnObj(_settledValue)); //#endif let handler = _state === ePromiseState.Resolved ? onResolved : onRejected; let value = isUndefined(handler) ? _settledValue : (isFunction(handler) ? handler(_settledValue) : handler); //#ifdef DEBUG - _debugLog(_toString(), "Handling Result " + dumpFnObj(value)); + //#:(!DEBUG) _debugLog(_toString(), "Handling Result " + dumpFnObj(value)); //#endif if (isPromiseLike(value)) { @@ -172,7 +172,7 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi }); //#ifdef DEBUG - _debugLog(_toString(), "Added to Queue " + _queue.length); + //#:(!DEBUG) _debugLog(_toString(), "Added to Queue " + _queue.length); //#endif // If this promise is already settled, then immediately process the callback we @@ -183,7 +183,7 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi }, additionalArgs); //#ifdef DEBUG - _debugLog(_toString(), "Created -> " + thenPromise.toString()); + //#:(!DEBUG) _debugLog(_toString(), "Created -> " + thenPromise.toString()); //#endif return thenPromise; @@ -230,7 +230,7 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi _queue = []; //#ifdef DEBUG - _debugLog(_toString(), "Processing queue " + pending.length); + //#:(!DEBUG) _debugLog(_toString(), "Processing queue " + pending.length); //#endif _handled = true; @@ -238,12 +238,12 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi _unHandledRejectionHandler = null; processor(pending); //#ifdef DEBUG - _debugLog(_toString(), "Processing done"); + //#:(!DEBUG) _debugLog(_toString(), "Processing done"); //#endif } else { //#ifdef DEBUG - _debugLog(_toString(), "Empty Processing queue "); + //#:(!DEBUG) _debugLog(_toString(), "Empty Processing queue "); //#endif } } @@ -254,7 +254,7 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi if (newState === ePromiseState.Resolved && isPromiseLike(theValue)) { _state = ePromiseState.Resolving; //#ifdef DEBUG - _debugLog(_toString(), "Resolving"); + //#:(!DEBUG) _debugLog(_toString(), "Resolving"); //#endif theValue.then( _createSettleIfFn(ePromiseState.Resolved, ePromiseState.Resolving), @@ -266,18 +266,18 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi _hasResolved = true; _settledValue = theValue; //#ifdef DEBUG - _debugLog(_toString(), _strState()); + //#:(!DEBUG) _debugLog(_toString(), _strState()); //#endif _processQueue(); if (!_handled && newState === ePromiseState.Rejected && !_unHandledRejectionHandler) { //#ifdef DEBUG - _debugLog(_toString(), "Setting up unhandled rejection"); + //#:(!DEBUG) _debugLog(_toString(), "Setting up unhandled rejection"); //#endif _unHandledRejectionHandler = scheduleTimeout(_notifyUnhandledRejection, _unhandledRejectionTimeout) } } else { //#ifdef DEBUG - _debugLog(_toString(), "Already " + _strState()); + //#:(!DEBUG) _debugLog(_toString(), "Already " + _strState()); //#endif } }; @@ -289,7 +289,7 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi _handled = true; if (isNode()) { //#ifdef DEBUG - _debugLog(_toString(), "Emitting " + NODE_UNHANDLED_REJECTION); + //#:(!DEBUG) _debugLog(_toString(), "Emitting " + NODE_UNHANDLED_REJECTION); //#endif process.emit(NODE_UNHANDLED_REJECTION, _settledValue, _thePromise); } else { @@ -298,7 +298,7 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi !_hasPromiseRejectionEvent && (_hasPromiseRejectionEvent = createCachedValue(safe(getInst<_PromiseRejectionEvent>, [STR_PROMISE + "RejectionEvent"]).v)); //#ifdef DEBUG - _debugLog(_toString(), "Emitting " + UNHANDLED_REJECTION); + //#:(!DEBUG) _debugLog(_toString(), "Emitting " + UNHANDLED_REJECTION); //#endif emitEvent(gbl, UNHANDLED_REJECTION, (theEvt: any) => { objDefine(theEvt, "promise", { g: () => _thePromise }); @@ -330,7 +330,7 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi let createStack: string; //#if DEBUG - createStack = _getCaller("Created", 5); + //#:(!{DEBUG}) createStack = _getCaller("Created", 5); //#endif function _toString() { return "IPromise" + (_promiseDebugEnabled ? "[" + _id + (!isUndefined(_parentId) ? (":" + _parentId) : "") + "]" : "") + " " + _strState() + (_hasResolved ? (" - " + dumpFnObj(_settledValue)) : "") + (createStack ? " @ " + createStack : ""); @@ -346,7 +346,7 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi const _rejectFn = _createSettleIfFn(ePromiseState.Rejected, ePromiseState.Pending); try { //#ifdef DEBUG - _debugLog(_toString(), "Executing"); + //#:(!DEBUG) _debugLog(_toString(), "Executing"); //#endif executor.call( _thePromise, @@ -354,18 +354,18 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi _rejectFn); } catch (e) { //#ifdef DEBUG - _debugLog(_toString(), "Exception thrown: " + dumpFnObj(e)); + //#:(!DEBUG) _debugLog(_toString(), "Exception thrown: " + dumpFnObj(e)); //#endif _rejectFn(e); } //#ifdef DEBUG - _debugLog(_toString(), "~Executing"); + //#:(!DEBUG) _debugLog(_toString(), "~Executing"); //#endif })(); //#ifdef DEBUG - _debugLog(_toString(), "Returning"); + //#:(!DEBUG) _debugLog(_toString(), "Returning"); //#endif return _thePromise; } @@ -437,7 +437,7 @@ export function _createResolvedPromise(newPromise: PromiseCreatorFn): (value: return newPromise((resolve) => { //#ifdef DEBUG - _debugLog(String(this), "Resolving Promise"); + //#:(!DEBUG) _debugLog(String(this), "Resolving Promise"); //#endif resolve(value); }, additionalArgs); @@ -459,7 +459,7 @@ export function _createRejectedPromise(newPromise: PromiseCreatorFn): (reason let additionalArgs = arrSlice(arguments, 1); return newPromise((_resolve, reject) => { //#ifdef DEBUG - _debugLog(String(this), "Rejecting Promise"); + //#:(!DEBUG) _debugLog(String(this), "Rejecting Promise"); //#endif reject(reason); }, additionalArgs); diff --git a/lib/src/promise/debug.ts b/lib/src/promise/debug.ts index f11af64..87d28d6 100644 --- a/lib/src/promise/debug.ts +++ b/lib/src/promise/debug.ts @@ -20,7 +20,7 @@ let _debugHandled: any; export let _promiseDebugEnabled = false; //#ifdef DEBUG -let _theLogger: (id: string, message: string) => void = null; +//#:(!DEBUG) let _theLogger: (id: string, message: string) => void = null; //#endif /** @@ -31,9 +31,9 @@ let _theLogger: (id: string, message: string) => void = null; */ export const _debugLog = (/*#__PURE__*/_pureAssign((id: string, message: string) => { //#ifdef DEBUG - if (_theLogger) { - _theLogger(id, message); - } + //#:(!DEBUG) if (_theLogger) { + //#:(!DEBUG) _theLogger(id, message); + //#:(!DEBUG) } //#endif })); @@ -100,6 +100,6 @@ export function _addDebugState(thePromise: any, stateFn: () => string, resultFn: export function setPromiseDebugState(enabled: boolean, logger?: (id: string, message: string) => void) { _promiseDebugEnabled = enabled; //#ifdef DEBUG - _theLogger = logger; + //#:(!DEBUG) _theLogger = logger; //#endif } \ No newline at end of file diff --git a/lib/src/promise/nativePromise.ts b/lib/src/promise/nativePromise.ts index 0f894a3..6946187 100644 --- a/lib/src/promise/nativePromise.ts +++ b/lib/src/promise/nativePromise.ts @@ -65,12 +65,12 @@ let _anyNativeCreator: ICachedValue<(values: */ export function _clearPromiseCache(useNative: boolean) { //#ifdef _DEBUG - _useNative = !!useNative; - _promiseCls = null as any; - _allCreator = null as any; - _allNativeSettledCreator = null as any; - _raceNativeCreator = null as any; - _anyNativeCreator = null as any; +//#:(!_DEBUG) _useNative = !!useNative; +//#:(!_DEBUG) _promiseCls = null as any; +//#:(!_DEBUG) _allCreator = null as any; +//#:(!_DEBUG) _allNativeSettledCreator = null as any; +//#:(!_DEBUG) _raceNativeCreator = null as any; +//#:(!_DEBUG) _anyNativeCreator = null as any; //#endif } diff --git a/lib/src/scheduler/taskScheduler.ts b/lib/src/scheduler/taskScheduler.ts index c352a85..aeffde8 100644 --- a/lib/src/scheduler/taskScheduler.ts +++ b/lib/src/scheduler/taskScheduler.ts @@ -15,7 +15,7 @@ import { ITaskScheduler } from "../interfaces/ITaskScheduler"; import { createPromise } from "../promise/promise"; //#ifdef DEBUG -import { _debugLog } from "../promise/debug"; +//#:(!DEBUG) import { _debugLog } from "../promise/debug"; //#endif const REJECT = "reject"; @@ -210,7 +210,7 @@ export function createTaskScheduler(newPromise?: (executor: PromiseExecutor(executor: PromiseExecutor(executor: PromiseExecutor { //#ifdef DEBUG - let taskId = taskDetail.id; - let prevTaskId = prevTask.id; - _debugLog(_schedulerName, "[" + taskId + "] is waiting for [" + prevTaskId + "] to complete before starting -- [" + _waiting.length + "] waiting"); + //#:(!DEBUG) let taskId = taskDetail.id; + //#:(!DEBUG) let prevTaskId = prevTask.id; + //#:(!DEBUG) _debugLog(_schedulerName, "[" + taskId + "] is waiting for [" + prevTaskId + "] to complete before starting -- [" + _waiting.length + "] waiting"); //#endif // Wait for the previous tasks to complete before starting this one. diff --git a/package.json b/package.json index cf978a3..c5c2e18 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,16 @@ "description": "support for asynchronous development with a Promise based task Scheduler, several different Promise implementations (synchronous, idle, asynchronous and native runtime wrappers), await helpers, and aliases all built and tested using TypeScript.", "version": "0.5.5", "homepage": "https://github.com/nevware21/ts-async", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/nevware21" + }, + { + "type": "buymeacoffee", + "url": "https://www.buymeacoffee.com/nevware21" + } + ], "sideEffects": false, "license": "MIT", "author": { From ac00995519c8f659cb8512b9caf380e7bcbff731 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 10 May 2026 17:28:56 +0000 Subject: [PATCH 3/3] chore: revert unintended preprocessor source edits Agent-Logs-Url: https://github.com/nevware21/ts-async/sessions/709e723a-2996-4c01-983d-d8d83a9bf416 Co-authored-by: nev21 <82737406+nev21@users.noreply.github.com> --- lib/src/promise/base.ts | 64 +++++++++++++++--------------- lib/src/promise/debug.ts | 10 ++--- lib/src/promise/nativePromise.ts | 12 +++--- lib/src/scheduler/taskScheduler.ts | 12 +++--- 4 files changed, 49 insertions(+), 49 deletions(-) diff --git a/lib/src/promise/base.ts b/lib/src/promise/base.ts index a87e0a9..ec26e69 100644 --- a/lib/src/promise/base.ts +++ b/lib/src/promise/base.ts @@ -25,7 +25,7 @@ import { REJECTED, STR_PROMISE } from "../internal/constants"; import { IPromiseResult } from "../interfaces/IPromiseResult"; //#ifdef DEBUG -//#:(!DEBUG) import { _debugLog } from "./debug"; +import { _debugLog } from "./debug"; //#endif const NODE_UNHANDLED_REJECTION = "unhandledRejection"; @@ -62,16 +62,16 @@ function dumpFnObj(value: any) { } //#ifdef DEBUG -//#:(!DEBUG) function _getCaller(prefix: string, start: number) { -//#:(!DEBUG) let stack = new Error().stack; -//#:(!DEBUG) if (stack) { -//#:(!DEBUG) let lines = stack.split("\n"); -//#:(!DEBUG) if (lines.length > start) { -//#:(!DEBUG) return prefix + ":" + arrSlice(lines, start, start + 5).join("\n") + "\n..."; -//#:(!DEBUG) } -//#:(!DEBUG) } -//#:(!DEBUG) return null; -//#:(!DEBUG) } +function _getCaller(prefix: string, start: number) { + let stack = new Error().stack; + if (stack) { + let lines = stack.split("\n"); + if (lines.length > start) { + return prefix + ":" + arrSlice(lines, start, start + 5).join("\n") + "\n..."; + } + } + return null; +} //#endif /*#__NO_SIDE_EFFECTS__*/ @@ -129,7 +129,7 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi let thenPromise = newPromise(function (resolve, reject) { //#ifdef DEBUG - //#:(!DEBUG) _debugLog(_toString(), _getCaller("_then", 7)); + _debugLog(_toString(), _getCaller("_then", 7)); //#endif // Queue the new promise returned to be resolved or rejected @@ -142,12 +142,12 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi // of this promise. If the corresponding `handler` does not exist, simply // pass through the settled value. //#ifdef DEBUG - //#:(!DEBUG) _debugLog(_toString(), "Handling settled value " + dumpFnObj(_settledValue)); + _debugLog(_toString(), "Handling settled value " + dumpFnObj(_settledValue)); //#endif let handler = _state === ePromiseState.Resolved ? onResolved : onRejected; let value = isUndefined(handler) ? _settledValue : (isFunction(handler) ? handler(_settledValue) : handler); //#ifdef DEBUG - //#:(!DEBUG) _debugLog(_toString(), "Handling Result " + dumpFnObj(value)); + _debugLog(_toString(), "Handling Result " + dumpFnObj(value)); //#endif if (isPromiseLike(value)) { @@ -172,7 +172,7 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi }); //#ifdef DEBUG - //#:(!DEBUG) _debugLog(_toString(), "Added to Queue " + _queue.length); + _debugLog(_toString(), "Added to Queue " + _queue.length); //#endif // If this promise is already settled, then immediately process the callback we @@ -183,7 +183,7 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi }, additionalArgs); //#ifdef DEBUG - //#:(!DEBUG) _debugLog(_toString(), "Created -> " + thenPromise.toString()); + _debugLog(_toString(), "Created -> " + thenPromise.toString()); //#endif return thenPromise; @@ -230,7 +230,7 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi _queue = []; //#ifdef DEBUG - //#:(!DEBUG) _debugLog(_toString(), "Processing queue " + pending.length); + _debugLog(_toString(), "Processing queue " + pending.length); //#endif _handled = true; @@ -238,12 +238,12 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi _unHandledRejectionHandler = null; processor(pending); //#ifdef DEBUG - //#:(!DEBUG) _debugLog(_toString(), "Processing done"); + _debugLog(_toString(), "Processing done"); //#endif } else { //#ifdef DEBUG - //#:(!DEBUG) _debugLog(_toString(), "Empty Processing queue "); + _debugLog(_toString(), "Empty Processing queue "); //#endif } } @@ -254,7 +254,7 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi if (newState === ePromiseState.Resolved && isPromiseLike(theValue)) { _state = ePromiseState.Resolving; //#ifdef DEBUG - //#:(!DEBUG) _debugLog(_toString(), "Resolving"); + _debugLog(_toString(), "Resolving"); //#endif theValue.then( _createSettleIfFn(ePromiseState.Resolved, ePromiseState.Resolving), @@ -266,18 +266,18 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi _hasResolved = true; _settledValue = theValue; //#ifdef DEBUG - //#:(!DEBUG) _debugLog(_toString(), _strState()); + _debugLog(_toString(), _strState()); //#endif _processQueue(); if (!_handled && newState === ePromiseState.Rejected && !_unHandledRejectionHandler) { //#ifdef DEBUG - //#:(!DEBUG) _debugLog(_toString(), "Setting up unhandled rejection"); + _debugLog(_toString(), "Setting up unhandled rejection"); //#endif _unHandledRejectionHandler = scheduleTimeout(_notifyUnhandledRejection, _unhandledRejectionTimeout) } } else { //#ifdef DEBUG - //#:(!DEBUG) _debugLog(_toString(), "Already " + _strState()); + _debugLog(_toString(), "Already " + _strState()); //#endif } }; @@ -289,7 +289,7 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi _handled = true; if (isNode()) { //#ifdef DEBUG - //#:(!DEBUG) _debugLog(_toString(), "Emitting " + NODE_UNHANDLED_REJECTION); + _debugLog(_toString(), "Emitting " + NODE_UNHANDLED_REJECTION); //#endif process.emit(NODE_UNHANDLED_REJECTION, _settledValue, _thePromise); } else { @@ -298,7 +298,7 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi !_hasPromiseRejectionEvent && (_hasPromiseRejectionEvent = createCachedValue(safe(getInst<_PromiseRejectionEvent>, [STR_PROMISE + "RejectionEvent"]).v)); //#ifdef DEBUG - //#:(!DEBUG) _debugLog(_toString(), "Emitting " + UNHANDLED_REJECTION); + _debugLog(_toString(), "Emitting " + UNHANDLED_REJECTION); //#endif emitEvent(gbl, UNHANDLED_REJECTION, (theEvt: any) => { objDefine(theEvt, "promise", { g: () => _thePromise }); @@ -330,7 +330,7 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi let createStack: string; //#if DEBUG - //#:(!{DEBUG}) createStack = _getCaller("Created", 5); + createStack = _getCaller("Created", 5); //#endif function _toString() { return "IPromise" + (_promiseDebugEnabled ? "[" + _id + (!isUndefined(_parentId) ? (":" + _parentId) : "") + "]" : "") + " " + _strState() + (_hasResolved ? (" - " + dumpFnObj(_settledValue)) : "") + (createStack ? " @ " + createStack : ""); @@ -346,7 +346,7 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi const _rejectFn = _createSettleIfFn(ePromiseState.Rejected, ePromiseState.Pending); try { //#ifdef DEBUG - //#:(!DEBUG) _debugLog(_toString(), "Executing"); + _debugLog(_toString(), "Executing"); //#endif executor.call( _thePromise, @@ -354,18 +354,18 @@ export function _createPromise(newPromise: PromiseCreatorFn, processor: Promi _rejectFn); } catch (e) { //#ifdef DEBUG - //#:(!DEBUG) _debugLog(_toString(), "Exception thrown: " + dumpFnObj(e)); + _debugLog(_toString(), "Exception thrown: " + dumpFnObj(e)); //#endif _rejectFn(e); } //#ifdef DEBUG - //#:(!DEBUG) _debugLog(_toString(), "~Executing"); + _debugLog(_toString(), "~Executing"); //#endif })(); //#ifdef DEBUG - //#:(!DEBUG) _debugLog(_toString(), "Returning"); + _debugLog(_toString(), "Returning"); //#endif return _thePromise; } @@ -437,7 +437,7 @@ export function _createResolvedPromise(newPromise: PromiseCreatorFn): (value: return newPromise((resolve) => { //#ifdef DEBUG - //#:(!DEBUG) _debugLog(String(this), "Resolving Promise"); + _debugLog(String(this), "Resolving Promise"); //#endif resolve(value); }, additionalArgs); @@ -459,7 +459,7 @@ export function _createRejectedPromise(newPromise: PromiseCreatorFn): (reason let additionalArgs = arrSlice(arguments, 1); return newPromise((_resolve, reject) => { //#ifdef DEBUG - //#:(!DEBUG) _debugLog(String(this), "Rejecting Promise"); + _debugLog(String(this), "Rejecting Promise"); //#endif reject(reason); }, additionalArgs); diff --git a/lib/src/promise/debug.ts b/lib/src/promise/debug.ts index 87d28d6..f11af64 100644 --- a/lib/src/promise/debug.ts +++ b/lib/src/promise/debug.ts @@ -20,7 +20,7 @@ let _debugHandled: any; export let _promiseDebugEnabled = false; //#ifdef DEBUG -//#:(!DEBUG) let _theLogger: (id: string, message: string) => void = null; +let _theLogger: (id: string, message: string) => void = null; //#endif /** @@ -31,9 +31,9 @@ export let _promiseDebugEnabled = false; */ export const _debugLog = (/*#__PURE__*/_pureAssign((id: string, message: string) => { //#ifdef DEBUG - //#:(!DEBUG) if (_theLogger) { - //#:(!DEBUG) _theLogger(id, message); - //#:(!DEBUG) } + if (_theLogger) { + _theLogger(id, message); + } //#endif })); @@ -100,6 +100,6 @@ export function _addDebugState(thePromise: any, stateFn: () => string, resultFn: export function setPromiseDebugState(enabled: boolean, logger?: (id: string, message: string) => void) { _promiseDebugEnabled = enabled; //#ifdef DEBUG - //#:(!DEBUG) _theLogger = logger; + _theLogger = logger; //#endif } \ No newline at end of file diff --git a/lib/src/promise/nativePromise.ts b/lib/src/promise/nativePromise.ts index 6946187..0f894a3 100644 --- a/lib/src/promise/nativePromise.ts +++ b/lib/src/promise/nativePromise.ts @@ -65,12 +65,12 @@ let _anyNativeCreator: ICachedValue<(values: */ export function _clearPromiseCache(useNative: boolean) { //#ifdef _DEBUG -//#:(!_DEBUG) _useNative = !!useNative; -//#:(!_DEBUG) _promiseCls = null as any; -//#:(!_DEBUG) _allCreator = null as any; -//#:(!_DEBUG) _allNativeSettledCreator = null as any; -//#:(!_DEBUG) _raceNativeCreator = null as any; -//#:(!_DEBUG) _anyNativeCreator = null as any; + _useNative = !!useNative; + _promiseCls = null as any; + _allCreator = null as any; + _allNativeSettledCreator = null as any; + _raceNativeCreator = null as any; + _anyNativeCreator = null as any; //#endif } diff --git a/lib/src/scheduler/taskScheduler.ts b/lib/src/scheduler/taskScheduler.ts index aeffde8..c352a85 100644 --- a/lib/src/scheduler/taskScheduler.ts +++ b/lib/src/scheduler/taskScheduler.ts @@ -15,7 +15,7 @@ import { ITaskScheduler } from "../interfaces/ITaskScheduler"; import { createPromise } from "../promise/promise"; //#ifdef DEBUG -//#:(!DEBUG) import { _debugLog } from "../promise/debug"; +import { _debugLog } from "../promise/debug"; //#endif const REJECT = "reject"; @@ -210,7 +210,7 @@ export function createTaskScheduler(newPromise?: (executor: PromiseExecutor(executor: PromiseExecutor(executor: PromiseExecutor { //#ifdef DEBUG - //#:(!DEBUG) let taskId = taskDetail.id; - //#:(!DEBUG) let prevTaskId = prevTask.id; - //#:(!DEBUG) _debugLog(_schedulerName, "[" + taskId + "] is waiting for [" + prevTaskId + "] to complete before starting -- [" + _waiting.length + "] waiting"); + let taskId = taskDetail.id; + let prevTaskId = prevTask.id; + _debugLog(_schedulerName, "[" + taskId + "] is waiting for [" + prevTaskId + "] to complete before starting -- [" + _waiting.length + "] waiting"); //#endif // Wait for the previous tasks to complete before starting this one.