@frui.ts/helpers
Advanced tools
Comparing version 0.16.1 to 0.16.2
export default class ManualPromise<T = any> { | ||
promise: Promise<T>; | ||
resolve: (result?: T | PromiseLike<T>) => void; | ||
reject: (reason: any) => void; | ||
status: "new" | "resolved" | "rejected"; | ||
private resolveCallback; | ||
private rejectCallback; | ||
constructor(); | ||
resolve(result?: T | PromiseLike<T>): void; | ||
reject(reason: any): void; | ||
} |
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var mobx_1 = require("mobx"); | ||
var ManualPromise = (function () { | ||
function ManualPromise() { | ||
var _this = this; | ||
this.status = "new"; | ||
this.promise = new Promise(function (resolve, reject) { | ||
_this.resolve = resolve; | ||
_this.reject = reject; | ||
_this.resolveCallback = resolve; | ||
_this.rejectCallback = reject; | ||
}); | ||
} | ||
ManualPromise.prototype.resolve = function (result) { | ||
this.resolveCallback(result); | ||
this.status = "resolved"; | ||
}; | ||
ManualPromise.prototype.reject = function (reason) { | ||
this.rejectCallback(reason); | ||
this.status = "rejected"; | ||
}; | ||
__decorate([ | ||
mobx_1.observable, | ||
__metadata("design:type", String) | ||
], ManualPromise.prototype, "status", void 0); | ||
__decorate([ | ||
mobx_1.action.bound, | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [Object]), | ||
__metadata("design:returntype", void 0) | ||
], ManualPromise.prototype, "resolve", null); | ||
__decorate([ | ||
mobx_1.action.bound, | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [Object]), | ||
__metadata("design:returntype", void 0) | ||
], ManualPromise.prototype, "reject", null); | ||
return ManualPromise; | ||
@@ -12,0 +47,0 @@ }()); |
@@ -6,3 +6,3 @@ { | ||
}, | ||
"version": "0.16.1", | ||
"version": "0.16.2", | ||
"description": "Frui.ts helper functions", | ||
@@ -40,3 +40,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "2d0dac85798eaefa37064a10fabca474c871c5d5" | ||
"gitHead": "4e9a698e964a13779157b1fe4a2dbb52cd7a64af" | ||
} |
Sorry, the diff of this file is not supported yet
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
24288
233