igniteui-react-core
Version:
Ignite UI React Core.
220 lines (219 loc) • 7.41 kB
JavaScript
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { __extends } from "tslib";
import { Base, markType, typeCastObjTo$t, getBoxIfEnum } from "./type";
import { PromiseFactory } from "./promise";
import { AggregateException } from "./AggregateException";
/**
* @hidden
*/
var Task = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(Task, _super);
function Task(a) {
var _rest = [];
for (var _i = 1; _i < arguments.length; _i++) {
_rest[_i - 1] = arguments[_i];
}
var _this = _super.call(this) || this;
_this.d = null;
_this.b = false;
_this.a = null;
_this.e = null;
a = (a == void 0) ? 0 : a;
switch (a) {
case 0:
{
var c = _rest[0];
var d = [c, null];
{
var f = d[0];
var g = d[1];
var h = function () {
};
var i = function (j) {
if (j == null) {
_this.b = true;
}
else {
_this.a = new AggregateException(2, "Exception occurred during task execution", j);
}
};
_this.d = f.done(h).fail(i);
_this.e = g;
}
}
break;
case 1:
{
var c = _rest[0];
var d = _rest[1];
var e = function () {
};
var f = function (g) {
if (g == null) {
_this.b = true;
}
else {
_this.a = new AggregateException(2, "Exception occurred during task execution", g);
}
};
_this.d = c.done(e).fail(f);
_this.e = d;
}
break;
}
return _this;
}
Object.defineProperty(Task.prototype, "c", {
get: function () {
return this.h == 5 || this.h == 7 || this.h == 6;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Task.prototype, "h", {
get: function () {
if (this.b) {
return 6;
}
switch (this.d.state()) {
case "pending": return 0;
case "resolved": return 5;
case "rejected": return 7;
default: return 0;
}
},
enumerable: false,
configurable: true
});
Task.prototype.f = function (a) {
var _this = this;
var b = function () { return a(_this); };
var c = function (d) { return a(_this); };
var d = this.d.done(b).fail(c);
return new Task(0, d);
};
Task.prototype.g = function ($tNewResult, a) {
var _this = this;
var b = new TaskCompletionSource$1($tNewResult, 0);
var c = function () {
try {
var d_1 = a(_this);
b.e(d_1);
}
catch (e) {
b.d((e));
}
};
var d = function (e) { return c(); };
var e = function (f) { return c(); };
this.d.done(d).fail(e);
return b.b;
};
Task.$t = markType(Task, 'Task');
return Task;
}(Base));
export { Task };
/**
* @hidden
*/
var Task$1 = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(Task$1, _super);
function Task$1($tResult, a, b) {
var _this = _super.call(this, 1, a, b) || this;
_this.$tResult = null;
_this.i = false;
_this.m = null;
_this.$tResult = $tResult;
_this.$type = _this.$type.specialize(_this.$tResult);
var c = function (d) {
var e = typeCastObjTo$t(_this.$tResult, d);
_this.m = e;
_this.i = true;
};
var d = function (e) { return _this.i = true; };
_this.d.done(c).fail(d);
return _this;
}
Object.defineProperty(Task$1.prototype, "n", {
get: function () {
if (!this.i) {
throw 'Result is not ready yet';
}
if (this.a != null) {
throw this.a;
}
return this.m;
},
enumerable: false,
configurable: true
});
Task$1.prototype.j = function (a) {
return _super.prototype.f.call(this, function (b) { return a(b); });
};
Task$1.prototype.k = function ($tNewResult, a) {
var b = function (c) { return getBoxIfEnum($tNewResult, a(c)); };
return this.l(Base.$, b).l($tNewResult, function (c) { return typeCastObjTo$t($tNewResult, c.n); });
};
Task$1.prototype.l = function ($tNewResult, a) {
return _super.prototype.g.call(this, $tNewResult, a);
};
Task$1.$t = markType(Task$1, 'Task$1', Task.$);
return Task$1;
}(Task));
export { Task$1 };
/**
* @hidden
*/
var TaskCompletionSource$1 = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(TaskCompletionSource$1, _super);
function TaskCompletionSource$1($tResult, a) {
var _rest = [];
for (var _i = 2; _i < arguments.length; _i++) {
_rest[_i - 2] = arguments[_i];
}
var _this = _super.call(this) || this;
_this.$tResult = null;
_this.a = null;
_this.b = null;
_this.$tResult = $tResult;
_this.$type = _this.$type.specialize(_this.$tResult);
a = (a == void 0) ? 0 : a;
switch (a) {
case 0:
{
var c = [null];
{
var e = c[0];
_this.a = new PromiseFactory();
_this.b = new Task$1(_this.$tResult, _this.a.promise(), e);
}
}
break;
case 1:
{
var c = _rest[0];
_this.a = new PromiseFactory();
_this.b = new Task$1(_this.$tResult, _this.a.promise(), c);
}
break;
}
return _this;
}
TaskCompletionSource$1.prototype.c = function () {
this.a.reject(null);
};
TaskCompletionSource$1.prototype.d = function (a) {
this.a.reject(a);
};
TaskCompletionSource$1.prototype.e = function (a) {
this.a.resolve(getBoxIfEnum(this.$tResult, a));
};
TaskCompletionSource$1.$t = markType(TaskCompletionSource$1, 'TaskCompletionSource$1');
return TaskCompletionSource$1;
}(Base));
export { TaskCompletionSource$1 };