mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 09:55:15 +00:00
1 line
3.9 KiB
JSON
1 line
3.9 KiB
JSON
{"ast":null,"code":"'use strict';\n\nvar Cancel = require('./Cancel');\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @class\n * @param {Function} executor The executor function.\n */\n\n\nfunction CancelToken(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n var resolvePromise;\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n var token = this;\n executor(function cancel(message) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new Cancel(message);\n resolvePromise(token.reason);\n });\n}\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\n\n\nCancelToken.prototype.throwIfRequested = function throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n};\n/**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\n\n\nCancelToken.source = function source() {\n var cancel;\n var token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token: token,\n cancel: cancel\n };\n};\n\nmodule.exports = CancelToken;","map":{"version":3,"sources":["/app/node_modules/axios/lib/cancel/CancelToken.js"],"names":["Cancel","require","CancelToken","executor","TypeError","resolvePromise","promise","Promise","promiseExecutor","resolve","token","cancel","message","reason","prototype","throwIfRequested","source","c","module","exports"],"mappings":"AAAA;;AAEA,IAAIA,MAAM,GAAGC,OAAO,CAAC,UAAD,CAApB;AAEA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,WAAT,CAAqBC,QAArB,EAA+B;AAC7B,MAAI,OAAOA,QAAP,KAAoB,UAAxB,EAAoC;AAClC,UAAM,IAAIC,SAAJ,CAAc,8BAAd,CAAN;AACD;;AAED,MAAIC,cAAJ;AACA,OAAKC,OAAL,GAAe,IAAIC,OAAJ,CAAY,SAASC,eAAT,CAAyBC,OAAzB,EAAkC;AAC3DJ,IAAAA,cAAc,GAAGI,OAAjB;AACD,GAFc,CAAf;AAIA,MAAIC,KAAK,GAAG,IAAZ;AACAP,EAAAA,QAAQ,CAAC,SAASQ,MAAT,CAAgBC,OAAhB,EAAyB;AAChC,QAAIF,KAAK,CAACG,MAAV,EAAkB;AAChB;AACA;AACD;;AAEDH,IAAAA,KAAK,CAACG,MAAN,GAAe,IAAIb,MAAJ,CAAWY,OAAX,CAAf;AACAP,IAAAA,cAAc,CAACK,KAAK,CAACG,MAAP,CAAd;AACD,GARO,CAAR;AASD;AAED;AACA;AACA;;;AACAX,WAAW,CAACY,SAAZ,CAAsBC,gBAAtB,GAAyC,SAASA,gBAAT,GAA4B;AACnE,MAAI,KAAKF,MAAT,EAAiB;AACf,UAAM,KAAKA,MAAX;AACD;AACF,CAJD;AAMA;AACA;AACA;AACA;;;AACAX,WAAW,CAACc,MAAZ,GAAqB,SAASA,MAAT,GAAkB;AACrC,MAAIL,MAAJ;AACA,MAAID,KAAK,GAAG,IAAIR,WAAJ,CAAgB,SAASC,QAAT,CAAkBc,CAAlB,EAAqB;AAC/CN,IAAAA,MAAM,GAAGM,CAAT;AACD,GAFW,CAAZ;AAGA,SAAO;AACLP,IAAAA,KAAK,EAAEA,KADF;AAELC,IAAAA,MAAM,EAAEA;AAFH,GAAP;AAID,CATD;;AAWAO,MAAM,CAACC,OAAP,GAAiBjB,WAAjB","sourcesContent":["'use strict';\n\nvar Cancel = require('./Cancel');\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @class\n * @param {Function} executor The executor function.\n */\nfunction CancelToken(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n var resolvePromise;\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n var token = this;\n executor(function cancel(message) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new Cancel(message);\n resolvePromise(token.reason);\n });\n}\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nCancelToken.prototype.throwIfRequested = function throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n};\n\n/**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\nCancelToken.source = function source() {\n var cancel;\n var token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token: token,\n cancel: cancel\n };\n};\n\nmodule.exports = CancelToken;\n"]},"metadata":{},"sourceType":"script"} |