Should debugging be enabled (defaults false
, when true
promises will have
additional debug properties and the toString
will include extra details.
Optional
logger: ((id: string, message: string) => void)Optional logger that will log internal state changes, only called in debug builds as the calling function is removed is the production artifacts.
// The Id is the id of the promise
// The message is the internal debug message
function promiseDebugLogger(id: string, message: string) {
if (console && console.log) {
console.log(id, message);
}
}
setPromiseDebugState(true, promiseDebugLogger);
// While the logger will not be called for the production packages
// Setting the `enabled` flag to tru will cause each promise to have
// the following additional properties added
// [[PromiseState]]; => Same as the `state` property
// [[PromiseResult]]; => The settled value
// [[PromiseIsHandled]] => Identifies if the promise has been handled
// It will also cause the `toString` for the promise to include additional
// debugging information
Debug helper to enable internal debugging of the promise implementations. Disabled by default. For the generated packages included in the npm package the
logger
will not be called as the_debugLog
function that uses this logger is removed during packaging.It is available directly from the repository for unit testing.