igniteui-react-core
Version:
Ignite UI React Core.
194 lines (193 loc) • 6.43 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 { Base, markType, typeCastObjTo$t, getBoxIfEnum } from "./type";
import { PromiseFactory } from "./promise";
import { AggregateException } from "./AggregateException";
/**
* @hidden
*/
export let Task = /*@__PURE__*/ (() => {
class Task extends Base {
constructor(a, ..._rest) {
super();
this.d = null;
this.b = false;
this.a = null;
this.e = null;
a = (a == void 0) ? 0 : a;
switch (a) {
case 0:
{
let c = _rest[0];
let d = [c, null];
{
let f = d[0];
let g = d[1];
let h = () => {
};
let i = (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:
{
let c = _rest[0];
let d = _rest[1];
let e = () => {
};
let f = (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;
}
}
get c() {
return this.h == 5 || this.h == 7 || this.h == 6;
}
get h() {
if (this.b) {
return 6;
}
switch (this.d.state()) {
case "pending": return 0;
case "resolved": return 5;
case "rejected": return 7;
default: return 0;
}
}
f(a) {
let b = () => a(this);
let c = (d) => a(this);
let d = this.d.done(b).fail(c);
return new Task(0, d);
}
g($tNewResult, a) {
let b = new TaskCompletionSource$1($tNewResult, 0);
let c = () => {
try {
let d = a(this);
b.e(d);
}
catch (e) {
b.d((e));
}
};
let d = (e) => c();
let e = (f) => c();
this.d.done(d).fail(e);
return b.b;
}
}
Task.$t = /*@__PURE__*/ markType(Task, 'Task');
return Task;
})();
/**
* @hidden
*/
export let Task$1 = /*@__PURE__*/ (() => {
class Task$1 extends Task {
constructor($tResult, a, b) {
super(1, a, b);
this.$tResult = null;
this.i = false;
this.m = null;
this.$tResult = $tResult;
this.$type = this.$type.specialize(this.$tResult);
let c = (d) => {
let e = typeCastObjTo$t(this.$tResult, d);
this.m = e;
this.i = true;
};
let d = (e) => this.i = true;
this.d.done(c).fail(d);
}
get n() {
if (!this.i) {
throw 'Result is not ready yet';
}
if (this.a != null) {
throw this.a;
}
return this.m;
}
j(a) {
return super.f((b) => a(b));
}
k($tNewResult, a) {
let b = (c) => getBoxIfEnum($tNewResult, a(c));
return this.l(Base.$, b).l($tNewResult, (c) => typeCastObjTo$t($tNewResult, c.n));
}
l($tNewResult, a) {
return super.g($tNewResult, a);
}
}
Task$1.$t = /*@__PURE__*/ markType(Task$1, 'Task$1', Task.$);
return Task$1;
})();
/**
* @hidden
*/
export let TaskCompletionSource$1 = /*@__PURE__*/ (() => {
class TaskCompletionSource$1 extends Base {
constructor($tResult, a, ..._rest) {
super();
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:
{
let c = [null];
{
let e = c[0];
this.a = new PromiseFactory();
this.b = new Task$1(this.$tResult, this.a.promise(), e);
}
}
break;
case 1:
{
let c = _rest[0];
this.a = new PromiseFactory();
this.b = new Task$1(this.$tResult, this.a.promise(), c);
}
break;
}
}
c() {
this.a.reject(null);
}
d(a) {
this.a.reject(a);
}
e(a) {
this.a.resolve(getBoxIfEnum(this.$tResult, a));
}
}
TaskCompletionSource$1.$t = /*@__PURE__*/ markType(TaskCompletionSource$1, 'TaskCompletionSource$1');
return TaskCompletionSource$1;
})();