opennms
Version:
Client API for the OpenNMS network monitoring platform
1 lines • 4.3 kB
JSON
{"remainingRequest":"/data/node_modules/babel-loader/lib/index.js!/data/node_modules/axios/lib/cancel/CancelToken.js","dependencies":[{"path":"/data/node_modules/axios/lib/cancel/CancelToken.js","mtime":1553611387516},{"path":"/data/.babelrc","mtime":1553611371556},{"path":"/data/node_modules/cache-loader/dist/cjs.js","mtime":1553611387012},{"path":"/data/node_modules/babel-loader/lib/index.js","mtime":1553611386992}],"contextDependencies":[],"result":["'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;",{"version":3,"sources":["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,SAASC,QAAQ,UAAR,CAAb;;AAEA;;;;;;AAMA,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,qBAAiBI,OAAjB;AACD,GAFc,CAAf;;AAIA,MAAIC,QAAQ,IAAZ;AACAP,WAAS,SAASQ,MAAT,CAAgBC,OAAhB,EAAyB;AAChC,QAAIF,MAAMG,MAAV,EAAkB;AAChB;AACA;AACD;;AAEDH,UAAMG,MAAN,GAAe,IAAIb,MAAJ,CAAWY,OAAX,CAAf;AACAP,mBAAeK,MAAMG,MAArB;AACD,GARD;AASD;;AAED;;;AAGAX,YAAYY,SAAZ,CAAsBC,gBAAtB,GAAyC,SAASA,gBAAT,GAA4B;AACnE,MAAI,KAAKF,MAAT,EAAiB;AACf,UAAM,KAAKA,MAAX;AACD;AACF,CAJD;;AAMA;;;;AAIAX,YAAYc,MAAZ,GAAqB,SAASA,MAAT,GAAkB;AACrC,MAAIL,MAAJ;AACA,MAAID,QAAQ,IAAIR,WAAJ,CAAgB,SAASC,QAAT,CAAkBc,CAAlB,EAAqB;AAC/CN,aAASM,CAAT;AACD,GAFW,CAAZ;AAGA,SAAO;AACLP,WAAOA,KADF;AAELC,YAAQA;AAFH,GAAP;AAID,CATD;;AAWAO,OAAOC,OAAP,GAAiBjB,WAAjB","file":"CancelToken.js","sourceRoot":"/data","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"]}]}