Comparing version 1.19.8 to 1.19.9
@@ -183,18 +183,26 @@ "use strict"; | ||
} | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (!(typeof fn === "function")) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, fn.apply(this, opts)]; | ||
case 1: | ||
_a.sent(); | ||
_a.label = 2; | ||
case 2: return [4 /*yield*/, lifetimesFn.apply(this, opts)]; | ||
case 3: | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
var result = null; | ||
if (typeof fn === "function") { | ||
result = fn.apply(this, opts); | ||
} | ||
if (typeof result === "object" && typeof (result === null || result === void 0 ? void 0 : result.then) === "function") { | ||
var that_1 = this; | ||
return (function runLifetimes() { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: return [4 /*yield*/, result]; | ||
case 1: | ||
_b.sent(); | ||
return [4 /*yield*/, ((_a = lifetimesFn === null || lifetimesFn === void 0 ? void 0 : lifetimesFn.apply) === null || _a === void 0 ? void 0 : _a.call(lifetimesFn, that_1, opts))]; | ||
case 2: | ||
_b.sent(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
})(); | ||
} | ||
return lifetimesFn.apply(this, opts); | ||
}; | ||
@@ -201,0 +209,0 @@ }); |
{ | ||
"name": "mipp-ali", | ||
"version": "1.19.8", | ||
"version": "1.19.9", | ||
"description": "小程序ts", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -128,8 +128,17 @@ import rfdc from "rfdc"; | ||
const lifetimesFn = _that?.lifetimes[keyName]; | ||
_that[keyName] = async function newFn(...opts) { | ||
_that[keyName] = function newFn(...opts) { | ||
let result: any = null; | ||
if (typeof fn === "function") { | ||
await fn.apply(this, opts); | ||
result = fn.apply(this, opts); | ||
} | ||
await lifetimesFn.apply(this, opts); | ||
if (typeof result === "object" && typeof result?.then === "function") { | ||
const that = this; | ||
return (async function runLifetimes() { | ||
await result; | ||
await lifetimesFn?.apply?.(that, opts); | ||
})(); | ||
} | ||
return lifetimesFn.apply(this, opts); | ||
}; | ||
@@ -136,0 +145,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
669132
23405