Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nextgis/cancelable-promise

Package Overview
Dependencies
Maintainers
0
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nextgis/cancelable-promise - npm Package Compare versions

Comparing version 2.3.0 to 2.5.0

8

lib/cancelable-promise.cjs.js

@@ -1,2 +0,2 @@

/** Bundle of @nextgis/cancelable-promise; version: 2.3.0; author: NextGIS */
/** Bundle of @nextgis/cancelable-promise; version: 2.5.0; author: NextGIS */
'use strict';

@@ -6,3 +6,3 @@

var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, key + "" , value);
class CancelError extends Error {

@@ -18,3 +18,3 @@ constructor() {

var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, key + "" , value);
class PromiseControl {

@@ -101,3 +101,3 @@ constructor(options = {}) {

var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "" , value);
class TimeoutError extends Error {

@@ -104,0 +104,0 @@ constructor() {

@@ -1,2 +0,2 @@

"use strict";var e=Object.defineProperty,t=(t,s,i)=>((t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i)(t,"symbol"!=typeof s?s+"":s,i);class s extends Error{constructor(){super(),t(this,"name","CancelError"),Object.setPrototypeOf(this,s.prototype)}}var i=Object.defineProperty,r=(e,t,s)=>((e,t,s)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);class n{constructor(e={}){this.options=e,r(this,"_promises",new Map)}get isLoaded(){return this._promises.size>0}remove(e){this._promises.has(e)&&(this._promises.delete(e),this._onStop())}get(e){return this._promises.get(e)}add(e,t){const s=t||e,i=this._promises.get(s);return this.options.onStart&&!this.isLoaded&&this.options.onStart(),i||(this._promises.set(s,e),e.finally((()=>{this.remove(s)})),e)}abort(){this.isLoaded&&(this._promises.forEach((e=>{e.cancel&&e.cancel()})),this._promises.clear(),this._onStop())}waitFunc(e,t=""){const s=this.get(t=t||e.name);return s||this.add(e(),t)}WaitForMe(e=""){const t=this.get.bind(this),s=this.add.bind(this);return function(i,r,n){const o=n.value;return e=e||r,n.value=function(...i){const r=t(e);if(r)return r;return s(o.apply(this,i),e)},n}}GetOrCreateDecorator(e=""){return this.WaitForMe(e)}_onStop(){this.options.onStop&&!this.isLoaded&&this.options.onStop()}}var o=Object.defineProperty,a=(e,t,s)=>((e,t,s)=>t in e?o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);class c extends Error{constructor(){super(),a(this,"name","TimeoutError"),Object.setPrototypeOf(this,c.prototype)}}var h,l=Object.defineProperty,p=(e,t,s)=>((e,t,s)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);const d=(e,t,s,i)=>{try{e(s(i))}catch(r){t(r)}};let _=0;h=Symbol.toStringTag;const m=class e{constructor(t,i){p(this,h),p(this,"id",_++),p(this,"_isCanceled",!1),p(this,"_isPending",!0),p(this,"_promise"),p(this,"_cancelPromise"),p(this,"_cancelHandlers",[]),p(this,"_setCanceledCallback"),p(this,"_parentPromise"),p(this,"_children",[]),this._cancelPromise=new Promise(((e,t)=>{this._setCanceledCallback=t=>e(t||new s)}));const r=[this._cancelPromise,new Promise(((s,i)=>t((t=>{t instanceof e?this.attach(t):this._isPending=!1,s(t)}),(e=>{this._isPending=!1,i(e)}),(e=>{if(!this._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");this._cancelHandlers.push(e)}))))];i&&r.push(new Promise(((e,t)=>{setTimeout((()=>{if(this._isPending)try{this.cancel()}finally{t(new c)}}),i)}))),this._promise=Promise.race(r)}static createControl(e){return new n(e)}static resolve(t){return new e((e=>e(t)))}static reject(t){return new e(((e,s)=>s(t)))}static all(t){return new e(((e,s)=>{Promise.all(t).then(e).catch(s)})).catch((e=>{if(e instanceof this.CancelError)for(const s of t){"cancel"in s&&s.cancel()}throw e}))}attach(e){this._isCanceled?e.cancel():this._children.push(e)}then(t,s){const i=new e(((e,i)=>{if(this._promise){const r=t=>{s?d(e,i,s,t):i(t)};this._promise.then((s=>{this._isCanceled?r(s):t?d(e,i,t,s):e(s)}),r)}}));return i._parentPromise=this,this._children.push(i),i}catch(e){return this._isCanceled&&e&&e(new s),this.then(void 0,e)}finally(e){return this._promise?this._promise.finally(e):Promise.reject(this._isCanceled?new s:e)}cancel(){if(this._isCanceled||!this._isPending)return this;this._isCanceled=!0;const e=this._getTopParent();if(e&&e.cancel(),this._children&&this._children.forEach((e=>e.cancel())),this._isPending){if(this._cancelHandlers.length)try{for(const e of this._cancelHandlers)e()}catch(t){}this._setCanceledCallback&&this._setCanceledCallback()}return this._destroy(),this}_getTopParent(){let e=this._parentPromise,t=!!e;for(;t;)e&&e._parentPromise?(e=e._parentPromise,t=!!e):t=!1;return e}_destroy(){this._setCanceledCallback=void 0,this._cancelPromise=void 0,this._promise=void 0}};p(m,"CancelError",s),p(m,"TimeoutError",c),p(m,"PromiseControl",n);let u=m;Object.setPrototypeOf(u.prototype,Promise.prototype),module.exports=u;
"use strict";var e=Object.defineProperty,t=(t,s,i)=>((t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i)(t,s+"",i);class s extends Error{constructor(){super(),t(this,"name","CancelError"),Object.setPrototypeOf(this,s.prototype)}}var i=Object.defineProperty,r=(e,t,s)=>((e,t,s)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,t+"",s);class n{constructor(e={}){this.options=e,r(this,"_promises",new Map)}get isLoaded(){return this._promises.size>0}remove(e){this._promises.has(e)&&(this._promises.delete(e),this._onStop())}get(e){return this._promises.get(e)}add(e,t){const s=t||e,i=this._promises.get(s);return this.options.onStart&&!this.isLoaded&&this.options.onStart(),i||(this._promises.set(s,e),e.finally((()=>{this.remove(s)})),e)}abort(){this.isLoaded&&(this._promises.forEach((e=>{e.cancel&&e.cancel()})),this._promises.clear(),this._onStop())}waitFunc(e,t=""){const s=this.get(t=t||e.name);return s||this.add(e(),t)}WaitForMe(e=""){const t=this.get.bind(this),s=this.add.bind(this);return function(i,r,n){const o=n.value;return e=e||r,n.value=function(...i){const r=t(e);if(r)return r;return s(o.apply(this,i),e)},n}}GetOrCreateDecorator(e=""){return this.WaitForMe(e)}_onStop(){this.options.onStop&&!this.isLoaded&&this.options.onStop()}}var o=Object.defineProperty,a=(e,t,s)=>((e,t,s)=>t in e?o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,t+"",s);class c extends Error{constructor(){super(),a(this,"name","TimeoutError"),Object.setPrototypeOf(this,c.prototype)}}var h,l=Object.defineProperty,d=(e,t,s)=>((e,t,s)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);const p=(e,t,s,i)=>{try{e(s(i))}catch(r){t(r)}};let _=0;h=Symbol.toStringTag;const u=class e{constructor(t,i){d(this,h),d(this,"id",_++),d(this,"_isCanceled",!1),d(this,"_isPending",!0),d(this,"_promise"),d(this,"_cancelPromise"),d(this,"_cancelHandlers",[]),d(this,"_setCanceledCallback"),d(this,"_parentPromise"),d(this,"_children",[]),this._cancelPromise=new Promise(((e,t)=>{this._setCanceledCallback=t=>e(t||new s)}));const r=[this._cancelPromise,new Promise(((s,i)=>t((t=>{t instanceof e?this.attach(t):this._isPending=!1,s(t)}),(e=>{this._isPending=!1,i(e)}),(e=>{if(!this._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");this._cancelHandlers.push(e)}))))];i&&r.push(new Promise(((e,t)=>{setTimeout((()=>{if(this._isPending)try{this.cancel()}finally{t(new c)}}),i)}))),this._promise=Promise.race(r)}static createControl(e){return new n(e)}static resolve(t){return new e((e=>e(t)))}static reject(t){return new e(((e,s)=>s(t)))}static all(t){return new e(((e,s)=>{Promise.all(t).then(e).catch(s)})).catch((e=>{if(e instanceof this.CancelError)for(const s of t){"cancel"in s&&s.cancel()}throw e}))}attach(e){this._isCanceled?e.cancel():this._children.push(e)}then(t,s){const i=new e(((e,i)=>{if(this._promise){const r=t=>{s?p(e,i,s,t):i(t)};this._promise.then((s=>{this._isCanceled?r(s):t?p(e,i,t,s):e(s)}),r)}}));return i._parentPromise=this,this._children.push(i),i}catch(e){return this._isCanceled&&e&&e(new s),this.then(void 0,e)}finally(e){return this._promise?this._promise.finally(e):Promise.reject(this._isCanceled?new s:e)}cancel(){if(this._isCanceled||!this._isPending)return this;this._isCanceled=!0;const e=this._getTopParent();if(e&&e.cancel(),this._children&&this._children.forEach((e=>e.cancel())),this._isPending){if(this._cancelHandlers.length)try{for(const e of this._cancelHandlers)e()}catch(t){}this._setCanceledCallback&&this._setCanceledCallback()}return this._destroy(),this}_getTopParent(){let e=this._parentPromise,t=!!e;for(;t;)e&&e._parentPromise?(e=e._parentPromise,t=!!e):t=!1;return e}_destroy(){this._setCanceledCallback=void 0,this._cancelPromise=void 0,this._promise=void 0}};d(u,"CancelError",s),d(u,"TimeoutError",c),d(u,"PromiseControl",n);let m=u;Object.setPrototypeOf(m.prototype,Promise.prototype),module.exports=m;
//# sourceMappingURL=cancelable-promise.cjs.prod.js.map

@@ -1,5 +0,5 @@

/** Bundle of @nextgis/cancelable-promise; version: 2.3.0; author: NextGIS */
/** Bundle of @nextgis/cancelable-promise; version: 2.5.0; author: NextGIS */
var __defProp$3 = Object.defineProperty;
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, key + "" , value);
class CancelError extends Error {

@@ -15,3 +15,3 @@ constructor() {

var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, key + "" , value);
class PromiseControl {

@@ -98,3 +98,3 @@ constructor(options = {}) {

var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "" , value);
class TimeoutError extends Error {

@@ -101,0 +101,0 @@ constructor() {

@@ -1,2 +0,2 @@

var e=Object.defineProperty,t=(t,s,i)=>((t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i)(t,"symbol"!=typeof s?s+"":s,i);class s extends Error{constructor(){super(),t(this,"name","CancelError"),Object.setPrototypeOf(this,s.prototype)}}var i=Object.defineProperty,r=(e,t,s)=>((e,t,s)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);class n{constructor(e={}){this.options=e,r(this,"_promises",new Map)}get isLoaded(){return this._promises.size>0}remove(e){this._promises.has(e)&&(this._promises.delete(e),this._onStop())}get(e){return this._promises.get(e)}add(e,t){const s=t||e,i=this._promises.get(s);return this.options.onStart&&!this.isLoaded&&this.options.onStart(),i||(this._promises.set(s,e),e.finally((()=>{this.remove(s)})),e)}abort(){this.isLoaded&&(this._promises.forEach((e=>{e.cancel&&e.cancel()})),this._promises.clear(),this._onStop())}waitFunc(e,t=""){const s=this.get(t=t||e.name);return s||this.add(e(),t)}WaitForMe(e=""){const t=this.get.bind(this),s=this.add.bind(this);return function(i,r,n){const o=n.value;return e=e||r,n.value=function(...i){const r=t(e);if(r)return r;return s(o.apply(this,i),e)},n}}GetOrCreateDecorator(e=""){return this.WaitForMe(e)}_onStop(){this.options.onStop&&!this.isLoaded&&this.options.onStop()}}var o=Object.defineProperty,a=(e,t,s)=>((e,t,s)=>t in e?o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);class c extends Error{constructor(){super(),a(this,"name","TimeoutError"),Object.setPrototypeOf(this,c.prototype)}}var h,l=Object.defineProperty,p=(e,t,s)=>((e,t,s)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);const d=(e,t,s,i)=>{try{e(s(i))}catch(r){t(r)}};let _=0;h=Symbol.toStringTag;const m=class e{constructor(t,i){p(this,h),p(this,"id",_++),p(this,"_isCanceled",!1),p(this,"_isPending",!0),p(this,"_promise"),p(this,"_cancelPromise"),p(this,"_cancelHandlers",[]),p(this,"_setCanceledCallback"),p(this,"_parentPromise"),p(this,"_children",[]),this._cancelPromise=new Promise(((e,t)=>{this._setCanceledCallback=t=>e(t||new s)}));const r=[this._cancelPromise,new Promise(((s,i)=>t((t=>{t instanceof e?this.attach(t):this._isPending=!1,s(t)}),(e=>{this._isPending=!1,i(e)}),(e=>{if(!this._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");this._cancelHandlers.push(e)}))))];i&&r.push(new Promise(((e,t)=>{setTimeout((()=>{if(this._isPending)try{this.cancel()}finally{t(new c)}}),i)}))),this._promise=Promise.race(r)}static createControl(e){return new n(e)}static resolve(t){return new e((e=>e(t)))}static reject(t){return new e(((e,s)=>s(t)))}static all(t){return new e(((e,s)=>{Promise.all(t).then(e).catch(s)})).catch((e=>{if(e instanceof this.CancelError)for(const s of t){"cancel"in s&&s.cancel()}throw e}))}attach(e){this._isCanceled?e.cancel():this._children.push(e)}then(t,s){const i=new e(((e,i)=>{if(this._promise){const r=t=>{s?d(e,i,s,t):i(t)};this._promise.then((s=>{this._isCanceled?r(s):t?d(e,i,t,s):e(s)}),r)}}));return i._parentPromise=this,this._children.push(i),i}catch(e){return this._isCanceled&&e&&e(new s),this.then(void 0,e)}finally(e){return this._promise?this._promise.finally(e):Promise.reject(this._isCanceled?new s:e)}cancel(){if(this._isCanceled||!this._isPending)return this;this._isCanceled=!0;const e=this._getTopParent();if(e&&e.cancel(),this._children&&this._children.forEach((e=>e.cancel())),this._isPending){if(this._cancelHandlers.length)try{for(const e of this._cancelHandlers)e()}catch(t){}this._setCanceledCallback&&this._setCanceledCallback()}return this._destroy(),this}_getTopParent(){let e=this._parentPromise,t=!!e;for(;t;)e&&e._parentPromise?(e=e._parentPromise,t=!!e):t=!1;return e}_destroy(){this._setCanceledCallback=void 0,this._cancelPromise=void 0,this._promise=void 0}};p(m,"CancelError",s),p(m,"TimeoutError",c),p(m,"PromiseControl",n);let u=m;Object.setPrototypeOf(u.prototype,Promise.prototype);export{u as default};
var e=Object.defineProperty,t=(t,s,i)=>((t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i)(t,s+"",i);class s extends Error{constructor(){super(),t(this,"name","CancelError"),Object.setPrototypeOf(this,s.prototype)}}var i=Object.defineProperty,r=(e,t,s)=>((e,t,s)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,t+"",s);class n{constructor(e={}){this.options=e,r(this,"_promises",new Map)}get isLoaded(){return this._promises.size>0}remove(e){this._promises.has(e)&&(this._promises.delete(e),this._onStop())}get(e){return this._promises.get(e)}add(e,t){const s=t||e,i=this._promises.get(s);return this.options.onStart&&!this.isLoaded&&this.options.onStart(),i||(this._promises.set(s,e),e.finally((()=>{this.remove(s)})),e)}abort(){this.isLoaded&&(this._promises.forEach((e=>{e.cancel&&e.cancel()})),this._promises.clear(),this._onStop())}waitFunc(e,t=""){const s=this.get(t=t||e.name);return s||this.add(e(),t)}WaitForMe(e=""){const t=this.get.bind(this),s=this.add.bind(this);return function(i,r,n){const o=n.value;return e=e||r,n.value=function(...i){const r=t(e);if(r)return r;return s(o.apply(this,i),e)},n}}GetOrCreateDecorator(e=""){return this.WaitForMe(e)}_onStop(){this.options.onStop&&!this.isLoaded&&this.options.onStop()}}var o=Object.defineProperty,a=(e,t,s)=>((e,t,s)=>t in e?o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,t+"",s);class c extends Error{constructor(){super(),a(this,"name","TimeoutError"),Object.setPrototypeOf(this,c.prototype)}}var h,l=Object.defineProperty,d=(e,t,s)=>((e,t,s)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);const p=(e,t,s,i)=>{try{e(s(i))}catch(r){t(r)}};let _=0;h=Symbol.toStringTag;const u=class e{constructor(t,i){d(this,h),d(this,"id",_++),d(this,"_isCanceled",!1),d(this,"_isPending",!0),d(this,"_promise"),d(this,"_cancelPromise"),d(this,"_cancelHandlers",[]),d(this,"_setCanceledCallback"),d(this,"_parentPromise"),d(this,"_children",[]),this._cancelPromise=new Promise(((e,t)=>{this._setCanceledCallback=t=>e(t||new s)}));const r=[this._cancelPromise,new Promise(((s,i)=>t((t=>{t instanceof e?this.attach(t):this._isPending=!1,s(t)}),(e=>{this._isPending=!1,i(e)}),(e=>{if(!this._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");this._cancelHandlers.push(e)}))))];i&&r.push(new Promise(((e,t)=>{setTimeout((()=>{if(this._isPending)try{this.cancel()}finally{t(new c)}}),i)}))),this._promise=Promise.race(r)}static createControl(e){return new n(e)}static resolve(t){return new e((e=>e(t)))}static reject(t){return new e(((e,s)=>s(t)))}static all(t){return new e(((e,s)=>{Promise.all(t).then(e).catch(s)})).catch((e=>{if(e instanceof this.CancelError)for(const s of t){"cancel"in s&&s.cancel()}throw e}))}attach(e){this._isCanceled?e.cancel():this._children.push(e)}then(t,s){const i=new e(((e,i)=>{if(this._promise){const r=t=>{s?p(e,i,s,t):i(t)};this._promise.then((s=>{this._isCanceled?r(s):t?p(e,i,t,s):e(s)}),r)}}));return i._parentPromise=this,this._children.push(i),i}catch(e){return this._isCanceled&&e&&e(new s),this.then(void 0,e)}finally(e){return this._promise?this._promise.finally(e):Promise.reject(this._isCanceled?new s:e)}cancel(){if(this._isCanceled||!this._isPending)return this;this._isCanceled=!0;const e=this._getTopParent();if(e&&e.cancel(),this._children&&this._children.forEach((e=>e.cancel())),this._isPending){if(this._cancelHandlers.length)try{for(const e of this._cancelHandlers)e()}catch(t){}this._setCanceledCallback&&this._setCanceledCallback()}return this._destroy(),this}_getTopParent(){let e=this._parentPromise,t=!!e;for(;t;)e&&e._parentPromise?(e=e._parentPromise,t=!!e):t=!1;return e}_destroy(){this._setCanceledCallback=void 0,this._cancelPromise=void 0,this._promise=void 0}};d(u,"CancelError",s),d(u,"TimeoutError",c),d(u,"PromiseControl",n);let m=u;Object.setPrototypeOf(m.prototype,Promise.prototype);export{m as default};
//# sourceMappingURL=cancelable-promise.esm-browser.prod.js.map

@@ -1,5 +0,5 @@

/** Bundle of @nextgis/cancelable-promise; version: 2.3.0; author: NextGIS */
/** Bundle of @nextgis/cancelable-promise; version: 2.5.0; author: NextGIS */
var __defProp$3 = Object.defineProperty;
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, key + "" , value);
class CancelError extends Error {

@@ -15,3 +15,3 @@ constructor() {

var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, key + "" , value);
class PromiseControl {

@@ -98,3 +98,3 @@ constructor(options = {}) {

var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "" , value);
class TimeoutError extends Error {

@@ -101,0 +101,0 @@ constructor() {

@@ -1,2 +0,2 @@

var e=Object.defineProperty,t=(t,s,i)=>((t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i)(t,"symbol"!=typeof s?s+"":s,i);class s extends Error{constructor(){super(),t(this,"name","CancelError"),Object.setPrototypeOf(this,s.prototype)}}var i=Object.defineProperty,r=(e,t,s)=>((e,t,s)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);class n{constructor(e={}){this.options=e,r(this,"_promises",new Map)}get isLoaded(){return this._promises.size>0}remove(e){this._promises.has(e)&&(this._promises.delete(e),this._onStop())}get(e){return this._promises.get(e)}add(e,t){const s=t||e,i=this._promises.get(s);return this.options.onStart&&!this.isLoaded&&this.options.onStart(),i||(this._promises.set(s,e),e.finally((()=>{this.remove(s)})),e)}abort(){this.isLoaded&&(this._promises.forEach((e=>{e.cancel&&e.cancel()})),this._promises.clear(),this._onStop())}waitFunc(e,t=""){const s=this.get(t=t||e.name);return s||this.add(e(),t)}WaitForMe(e=""){const t=this.get.bind(this),s=this.add.bind(this);return function(i,r,n){const o=n.value;return e=e||r,n.value=function(...i){const r=t(e);if(r)return r;return s(o.apply(this,i),e)},n}}GetOrCreateDecorator(e=""){return this.WaitForMe(e)}_onStop(){this.options.onStop&&!this.isLoaded&&this.options.onStop()}}var o=Object.defineProperty,a=(e,t,s)=>((e,t,s)=>t in e?o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);class c extends Error{constructor(){super(),a(this,"name","TimeoutError"),Object.setPrototypeOf(this,c.prototype)}}var h,l=Object.defineProperty,p=(e,t,s)=>((e,t,s)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);const d=(e,t,s,i)=>{try{e(s(i))}catch(r){t(r)}};let _=0;h=Symbol.toStringTag;const m=class e{constructor(t,i){p(this,h),p(this,"id",_++),p(this,"_isCanceled",!1),p(this,"_isPending",!0),p(this,"_promise"),p(this,"_cancelPromise"),p(this,"_cancelHandlers",[]),p(this,"_setCanceledCallback"),p(this,"_parentPromise"),p(this,"_children",[]),this._cancelPromise=new Promise(((e,t)=>{this._setCanceledCallback=t=>e(t||new s)}));const r=[this._cancelPromise,new Promise(((s,i)=>t((t=>{t instanceof e?this.attach(t):this._isPending=!1,s(t)}),(e=>{this._isPending=!1,i(e)}),(e=>{if(!this._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");this._cancelHandlers.push(e)}))))];i&&r.push(new Promise(((e,t)=>{setTimeout((()=>{if(this._isPending)try{this.cancel()}finally{t(new c)}}),i)}))),this._promise=Promise.race(r)}static createControl(e){return new n(e)}static resolve(t){return new e((e=>e(t)))}static reject(t){return new e(((e,s)=>s(t)))}static all(t){return new e(((e,s)=>{Promise.all(t).then(e).catch(s)})).catch((e=>{if(e instanceof this.CancelError)for(const s of t){"cancel"in s&&s.cancel()}throw e}))}attach(e){this._isCanceled?e.cancel():this._children.push(e)}then(t,s){const i=new e(((e,i)=>{if(this._promise){const r=t=>{s?d(e,i,s,t):i(t)};this._promise.then((s=>{this._isCanceled?r(s):t?d(e,i,t,s):e(s)}),r)}}));return i._parentPromise=this,this._children.push(i),i}catch(e){return this._isCanceled&&e&&e(new s),this.then(void 0,e)}finally(e){return this._promise?this._promise.finally(e):Promise.reject(this._isCanceled?new s:e)}cancel(){if(this._isCanceled||!this._isPending)return this;this._isCanceled=!0;const e=this._getTopParent();if(e&&e.cancel(),this._children&&this._children.forEach((e=>e.cancel())),this._isPending){if(this._cancelHandlers.length)try{for(const e of this._cancelHandlers)e()}catch(t){}this._setCanceledCallback&&this._setCanceledCallback()}return this._destroy(),this}_getTopParent(){let e=this._parentPromise,t=!!e;for(;t;)e&&e._parentPromise?(e=e._parentPromise,t=!!e):t=!1;return e}_destroy(){this._setCanceledCallback=void 0,this._cancelPromise=void 0,this._promise=void 0}};p(m,"CancelError",s),p(m,"TimeoutError",c),p(m,"PromiseControl",n);let u=m;Object.setPrototypeOf(u.prototype,Promise.prototype);export{u as default};
var e=Object.defineProperty,t=(t,s,i)=>((t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i)(t,s+"",i);class s extends Error{constructor(){super(),t(this,"name","CancelError"),Object.setPrototypeOf(this,s.prototype)}}var i=Object.defineProperty,r=(e,t,s)=>((e,t,s)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,t+"",s);class n{constructor(e={}){this.options=e,r(this,"_promises",new Map)}get isLoaded(){return this._promises.size>0}remove(e){this._promises.has(e)&&(this._promises.delete(e),this._onStop())}get(e){return this._promises.get(e)}add(e,t){const s=t||e,i=this._promises.get(s);return this.options.onStart&&!this.isLoaded&&this.options.onStart(),i||(this._promises.set(s,e),e.finally((()=>{this.remove(s)})),e)}abort(){this.isLoaded&&(this._promises.forEach((e=>{e.cancel&&e.cancel()})),this._promises.clear(),this._onStop())}waitFunc(e,t=""){const s=this.get(t=t||e.name);return s||this.add(e(),t)}WaitForMe(e=""){const t=this.get.bind(this),s=this.add.bind(this);return function(i,r,n){const o=n.value;return e=e||r,n.value=function(...i){const r=t(e);if(r)return r;return s(o.apply(this,i),e)},n}}GetOrCreateDecorator(e=""){return this.WaitForMe(e)}_onStop(){this.options.onStop&&!this.isLoaded&&this.options.onStop()}}var o=Object.defineProperty,a=(e,t,s)=>((e,t,s)=>t in e?o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,t+"",s);class c extends Error{constructor(){super(),a(this,"name","TimeoutError"),Object.setPrototypeOf(this,c.prototype)}}var h,l=Object.defineProperty,d=(e,t,s)=>((e,t,s)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);const p=(e,t,s,i)=>{try{e(s(i))}catch(r){t(r)}};let _=0;h=Symbol.toStringTag;const u=class e{constructor(t,i){d(this,h),d(this,"id",_++),d(this,"_isCanceled",!1),d(this,"_isPending",!0),d(this,"_promise"),d(this,"_cancelPromise"),d(this,"_cancelHandlers",[]),d(this,"_setCanceledCallback"),d(this,"_parentPromise"),d(this,"_children",[]),this._cancelPromise=new Promise(((e,t)=>{this._setCanceledCallback=t=>e(t||new s)}));const r=[this._cancelPromise,new Promise(((s,i)=>t((t=>{t instanceof e?this.attach(t):this._isPending=!1,s(t)}),(e=>{this._isPending=!1,i(e)}),(e=>{if(!this._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");this._cancelHandlers.push(e)}))))];i&&r.push(new Promise(((e,t)=>{setTimeout((()=>{if(this._isPending)try{this.cancel()}finally{t(new c)}}),i)}))),this._promise=Promise.race(r)}static createControl(e){return new n(e)}static resolve(t){return new e((e=>e(t)))}static reject(t){return new e(((e,s)=>s(t)))}static all(t){return new e(((e,s)=>{Promise.all(t).then(e).catch(s)})).catch((e=>{if(e instanceof this.CancelError)for(const s of t){"cancel"in s&&s.cancel()}throw e}))}attach(e){this._isCanceled?e.cancel():this._children.push(e)}then(t,s){const i=new e(((e,i)=>{if(this._promise){const r=t=>{s?p(e,i,s,t):i(t)};this._promise.then((s=>{this._isCanceled?r(s):t?p(e,i,t,s):e(s)}),r)}}));return i._parentPromise=this,this._children.push(i),i}catch(e){return this._isCanceled&&e&&e(new s),this.then(void 0,e)}finally(e){return this._promise?this._promise.finally(e):Promise.reject(this._isCanceled?new s:e)}cancel(){if(this._isCanceled||!this._isPending)return this;this._isCanceled=!0;const e=this._getTopParent();if(e&&e.cancel(),this._children&&this._children.forEach((e=>e.cancel())),this._isPending){if(this._cancelHandlers.length)try{for(const e of this._cancelHandlers)e()}catch(t){}this._setCanceledCallback&&this._setCanceledCallback()}return this._destroy(),this}_getTopParent(){let e=this._parentPromise,t=!!e;for(;t;)e&&e._parentPromise?(e=e._parentPromise,t=!!e):t=!1;return e}_destroy(){this._setCanceledCallback=void 0,this._cancelPromise=void 0,this._promise=void 0}};d(u,"CancelError",s),d(u,"TimeoutError",c),d(u,"PromiseControl",n);let m=u;Object.setPrototypeOf(m.prototype,Promise.prototype);export{m as default};
//# sourceMappingURL=cancelable-promise.esm-bundler.prod.js.map

@@ -1,2 +0,2 @@

/** Bundle of @nextgis/cancelable-promise; version: 2.3.0; author: NextGIS */
/** Bundle of @nextgis/cancelable-promise; version: 2.5.0; author: NextGIS */
var CancelablePromise = (function () {

@@ -7,3 +7,3 @@ 'use strict';

var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, key + "" , value);
class CancelError extends Error {

@@ -19,3 +19,3 @@ constructor() {

var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, key + "" , value);
class PromiseControl {

@@ -102,3 +102,3 @@ constructor(options = {}) {

var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "" , value);
class TimeoutError extends Error {

@@ -105,0 +105,0 @@ constructor() {

@@ -1,2 +0,2 @@

var CancelablePromise=function(){"use strict";var e=Object.defineProperty,t=(t,s,i)=>((t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i)(t,"symbol"!=typeof s?s+"":s,i);class s extends Error{constructor(){super(),t(this,"name","CancelError"),Object.setPrototypeOf(this,s.prototype)}}var i=Object.defineProperty,r=(e,t,s)=>((e,t,s)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);class n{constructor(e={}){this.options=e,r(this,"_promises",new Map)}get isLoaded(){return this._promises.size>0}remove(e){this._promises.has(e)&&(this._promises.delete(e),this._onStop())}get(e){return this._promises.get(e)}add(e,t){const s=t||e,i=this._promises.get(s);return this.options.onStart&&!this.isLoaded&&this.options.onStart(),i||(this._promises.set(s,e),e.finally((()=>{this.remove(s)})),e)}abort(){this.isLoaded&&(this._promises.forEach((e=>{e.cancel&&e.cancel()})),this._promises.clear(),this._onStop())}waitFunc(e,t=""){const s=this.get(t=t||e.name);return s||this.add(e(),t)}WaitForMe(e=""){const t=this.get.bind(this),s=this.add.bind(this);return function(i,r,n){const o=n.value;return e=e||r,n.value=function(...i){const r=t(e);if(r)return r;return s(o.apply(this,i),e)},n}}GetOrCreateDecorator(e=""){return this.WaitForMe(e)}_onStop(){this.options.onStop&&!this.isLoaded&&this.options.onStop()}}var o=Object.defineProperty,a=(e,t,s)=>((e,t,s)=>t in e?o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);class c extends Error{constructor(){super(),a(this,"name","TimeoutError"),Object.setPrototypeOf(this,c.prototype)}}var h,l=Object.defineProperty,p=(e,t,s)=>((e,t,s)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);const d=(e,t,s,i)=>{try{e(s(i))}catch(r){t(r)}};let _=0;h=Symbol.toStringTag;const m=class e{constructor(t,i){p(this,h),p(this,"id",_++),p(this,"_isCanceled",!1),p(this,"_isPending",!0),p(this,"_promise"),p(this,"_cancelPromise"),p(this,"_cancelHandlers",[]),p(this,"_setCanceledCallback"),p(this,"_parentPromise"),p(this,"_children",[]),this._cancelPromise=new Promise(((e,t)=>{this._setCanceledCallback=t=>e(t||new s)}));const r=[this._cancelPromise,new Promise(((s,i)=>t((t=>{t instanceof e?this.attach(t):this._isPending=!1,s(t)}),(e=>{this._isPending=!1,i(e)}),(e=>{if(!this._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");this._cancelHandlers.push(e)}))))];i&&r.push(new Promise(((e,t)=>{setTimeout((()=>{if(this._isPending)try{this.cancel()}finally{t(new c)}}),i)}))),this._promise=Promise.race(r)}static createControl(e){return new n(e)}static resolve(t){return new e((e=>e(t)))}static reject(t){return new e(((e,s)=>s(t)))}static all(t){return new e(((e,s)=>{Promise.all(t).then(e).catch(s)})).catch((e=>{if(e instanceof this.CancelError)for(const s of t){"cancel"in s&&s.cancel()}throw e}))}attach(e){this._isCanceled?e.cancel():this._children.push(e)}then(t,s){const i=new e(((e,i)=>{if(this._promise){const r=t=>{s?d(e,i,s,t):i(t)};this._promise.then((s=>{this._isCanceled?r(s):t?d(e,i,t,s):e(s)}),r)}}));return i._parentPromise=this,this._children.push(i),i}catch(e){return this._isCanceled&&e&&e(new s),this.then(void 0,e)}finally(e){return this._promise?this._promise.finally(e):Promise.reject(this._isCanceled?new s:e)}cancel(){if(this._isCanceled||!this._isPending)return this;this._isCanceled=!0;const e=this._getTopParent();if(e&&e.cancel(),this._children&&this._children.forEach((e=>e.cancel())),this._isPending){if(this._cancelHandlers.length)try{for(const e of this._cancelHandlers)e()}catch(t){}this._setCanceledCallback&&this._setCanceledCallback()}return this._destroy(),this}_getTopParent(){let e=this._parentPromise,t=!!e;for(;t;)e&&e._parentPromise?(e=e._parentPromise,t=!!e):t=!1;return e}_destroy(){this._setCanceledCallback=void 0,this._cancelPromise=void 0,this._promise=void 0}};p(m,"CancelError",s),p(m,"TimeoutError",c),p(m,"PromiseControl",n);let u=m;return Object.setPrototypeOf(u.prototype,Promise.prototype),u}();
var CancelablePromise=function(){"use strict";var e=Object.defineProperty,t=(t,s,i)=>((t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i)(t,s+"",i);class s extends Error{constructor(){super(),t(this,"name","CancelError"),Object.setPrototypeOf(this,s.prototype)}}var i=Object.defineProperty,r=(e,t,s)=>((e,t,s)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,t+"",s);class n{constructor(e={}){this.options=e,r(this,"_promises",new Map)}get isLoaded(){return this._promises.size>0}remove(e){this._promises.has(e)&&(this._promises.delete(e),this._onStop())}get(e){return this._promises.get(e)}add(e,t){const s=t||e,i=this._promises.get(s);return this.options.onStart&&!this.isLoaded&&this.options.onStart(),i||(this._promises.set(s,e),e.finally((()=>{this.remove(s)})),e)}abort(){this.isLoaded&&(this._promises.forEach((e=>{e.cancel&&e.cancel()})),this._promises.clear(),this._onStop())}waitFunc(e,t=""){const s=this.get(t=t||e.name);return s||this.add(e(),t)}WaitForMe(e=""){const t=this.get.bind(this),s=this.add.bind(this);return function(i,r,n){const o=n.value;return e=e||r,n.value=function(...i){const r=t(e);if(r)return r;return s(o.apply(this,i),e)},n}}GetOrCreateDecorator(e=""){return this.WaitForMe(e)}_onStop(){this.options.onStop&&!this.isLoaded&&this.options.onStop()}}var o=Object.defineProperty,a=(e,t,s)=>((e,t,s)=>t in e?o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,t+"",s);class c extends Error{constructor(){super(),a(this,"name","TimeoutError"),Object.setPrototypeOf(this,c.prototype)}}var h,l=Object.defineProperty,d=(e,t,s)=>((e,t,s)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);const _=(e,t,s,i)=>{try{e(s(i))}catch(r){t(r)}};let p=0;h=Symbol.toStringTag;const u=class e{constructor(t,i){d(this,h),d(this,"id",p++),d(this,"_isCanceled",!1),d(this,"_isPending",!0),d(this,"_promise"),d(this,"_cancelPromise"),d(this,"_cancelHandlers",[]),d(this,"_setCanceledCallback"),d(this,"_parentPromise"),d(this,"_children",[]),this._cancelPromise=new Promise(((e,t)=>{this._setCanceledCallback=t=>e(t||new s)}));const r=[this._cancelPromise,new Promise(((s,i)=>t((t=>{t instanceof e?this.attach(t):this._isPending=!1,s(t)}),(e=>{this._isPending=!1,i(e)}),(e=>{if(!this._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");this._cancelHandlers.push(e)}))))];i&&r.push(new Promise(((e,t)=>{setTimeout((()=>{if(this._isPending)try{this.cancel()}finally{t(new c)}}),i)}))),this._promise=Promise.race(r)}static createControl(e){return new n(e)}static resolve(t){return new e((e=>e(t)))}static reject(t){return new e(((e,s)=>s(t)))}static all(t){return new e(((e,s)=>{Promise.all(t).then(e).catch(s)})).catch((e=>{if(e instanceof this.CancelError)for(const s of t){"cancel"in s&&s.cancel()}throw e}))}attach(e){this._isCanceled?e.cancel():this._children.push(e)}then(t,s){const i=new e(((e,i)=>{if(this._promise){const r=t=>{s?_(e,i,s,t):i(t)};this._promise.then((s=>{this._isCanceled?r(s):t?_(e,i,t,s):e(s)}),r)}}));return i._parentPromise=this,this._children.push(i),i}catch(e){return this._isCanceled&&e&&e(new s),this.then(void 0,e)}finally(e){return this._promise?this._promise.finally(e):Promise.reject(this._isCanceled?new s:e)}cancel(){if(this._isCanceled||!this._isPending)return this;this._isCanceled=!0;const e=this._getTopParent();if(e&&e.cancel(),this._children&&this._children.forEach((e=>e.cancel())),this._isPending){if(this._cancelHandlers.length)try{for(const e of this._cancelHandlers)e()}catch(t){}this._setCanceledCallback&&this._setCanceledCallback()}return this._destroy(),this}_getTopParent(){let e=this._parentPromise,t=!!e;for(;t;)e&&e._parentPromise?(e=e._parentPromise,t=!!e):t=!1;return e}_destroy(){this._setCanceledCallback=void 0,this._cancelPromise=void 0,this._promise=void 0}};d(u,"CancelError",s),d(u,"TimeoutError",c),d(u,"PromiseControl",n);let m=u;return Object.setPrototypeOf(m.prototype,Promise.prototype),m}();
//# sourceMappingURL=cancelable-promise.global.prod.js.map
{
"name": "@nextgis/cancelable-promise",
"version": "2.3.0",
"version": "2.5.0",
"description": "A promise you can stop",

@@ -11,3 +11,3 @@ "main": "index.js",

"devDependencies": {
"@nextgis/build-tools": "^2.3.0"
"@nextgis/build-tools": "^2.5.0"
},

@@ -48,3 +48,3 @@ "buildOptions": {

},
"gitHead": "e25d812d39f6c704adb2884ffbf20e84ef7cb1dc"
"gitHead": "7ed42736d080f0e22acc996a95f6406e96ab527c"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc