UNPKG

@lobehub/editor

Version:

A powerful and extensible rich text editor built on Meta's Lexical framework, providing a modern editing experience with React integration.

20 lines 425 B
export function setCancelablePromise(executor) { var isCancelled = false; var promise = new Promise(function (resolve, reject) { executor(function (value) { if (!isCancelled) { resolve(value); } }, function (reason) { if (!isCancelled) { reject(reason); } }); }); return { cancel: function cancel() { isCancelled = true; }, promise: promise }; }