jsf.js_next_gen 4.0.0-RC.6 → 4.0.0-RC.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs/assets/main.js +1 -1
- package/dist/window/faces-development.js +2056 -2727
- package/dist/window/faces-development.js.br +0 -0
- package/dist/window/faces-development.js.gz +0 -0
- package/dist/window/faces-development.js.map +1 -1
- package/dist/window/faces.js +1 -1
- package/dist/window/faces.js.br +0 -0
- package/dist/window/faces.js.gz +0 -0
- package/dist/window/faces.js.map +1 -1
- package/dist/window/jsf-development.js +2061 -2732
- package/dist/window/jsf-development.js.br +0 -0
- package/dist/window/jsf-development.js.gz +0 -0
- package/dist/window/jsf-development.js.map +1 -1
- package/dist/window/jsf.js +1 -1
- package/dist/window/jsf.js.br +0 -0
- package/dist/window/jsf.js.gz +0 -0
- package/dist/window/jsf.js.map +1 -1
- package/package.json +6 -6
- package/src/main/typescript/impl/util/Assertions.ts +14 -6
- package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +11 -1
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +65 -0
- package/src/main/typescript/tsconfig.json +1 -1
- package/target/api/_api.js +11 -25
- package/target/api/_api.js.map +1 -1
- package/target/api/faces.js +4 -4
- package/target/api/faces.js.map +1 -1
- package/target/api/jsf.js +9 -9
- package/target/api/jsf.js.map +1 -1
- package/target/impl/AjaxImpl.js +55 -63
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/PushImpl.js +45 -48
- package/target/impl/PushImpl.js.map +1 -1
- package/target/impl/core/Const.js +1 -1
- package/target/impl/core/Const.js.map +1 -1
- package/target/impl/core/ImplTypes.js +9 -14
- package/target/impl/core/ImplTypes.js.map +1 -1
- package/target/impl/i18n/Messages.js +3 -4
- package/target/impl/i18n/Messages.js.map +1 -1
- package/target/impl/util/Assertions.js +19 -23
- package/target/impl/util/Assertions.js.map +1 -1
- package/target/impl/util/AsyncQueue.js +28 -36
- package/target/impl/util/AsyncQueue.js.map +1 -1
- package/target/impl/util/ExtDomQuery.js +144 -219
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/impl/util/Lang.js +21 -28
- package/target/impl/util/Lang.js.map +1 -1
- package/target/impl/xhrCore/ErrorData.js +36 -61
- package/target/impl/xhrCore/ErrorData.js.map +1 -1
- package/target/impl/xhrCore/EventData.js +10 -13
- package/target/impl/xhrCore/EventData.js.map +1 -1
- package/target/impl/xhrCore/RequestDataResolver.js +27 -19
- package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
- package/target/impl/xhrCore/ResonseDataResolver.js +16 -16
- package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
- package/target/impl/xhrCore/Response.js +16 -16
- package/target/impl/xhrCore/Response.js.map +1 -1
- package/target/impl/xhrCore/ResponseProcessor.js +119 -133
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +72 -106
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js +85 -95
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/myfaces/OamSubmit.js +17 -24
- package/target/myfaces/OamSubmit.js.map +1 -1
- package/target/test/frameworkBase/LangTest.spec.js +46 -32
- package/target/test/frameworkBase/LangTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +238 -228
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/LangTest.spec.js +45 -31
- package/target/test/frameworkBase/_ext/monadish/LangTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/MappingProbes.js +24 -33
- package/target/test/frameworkBase/_ext/monadish/MappingProbes.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/MappingTest.spec.js +8 -8
- package/target/test/frameworkBase/_ext/monadish/MappingTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +31 -31
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/StreamTest.spec.js +50 -48
- package/target/test/frameworkBase/_ext/monadish/StreamTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +247 -132
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js +199 -22
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
- package/target/test/impl/ImplTest.spec.js +32 -59
- package/target/test/impl/ImplTest.spec.js.map +1 -1
- package/target/test/impl/ImplTest_23.spec.js +32 -59
- package/target/test/impl/ImplTest_23.spec.js.map +1 -1
- package/target/test/impl/SeparatorCharsTest.spec.js +17 -17
- package/target/test/impl/SeparatorCharsTest.spec.js.map +1 -1
- package/target/test/myfaces/OamSubmit.spec.js +25 -25
- package/target/test/myfaces/OamSubmit.spec.js.map +1 -1
- package/target/test/queue/AsynchronousProbe.js +23 -29
- package/target/test/queue/AsynchronousProbe.js.map +1 -1
- package/target/test/queue/AsynchronousQueueTest.spec.js +39 -70
- package/target/test/queue/AsynchronousQueueTest.spec.js.map +1 -1
- package/target/test/xhrCore/EventTests.spec.js +42 -73
- package/target/test/xhrCore/EventTests.spec.js.map +1 -1
- package/target/test/xhrCore/FakeWebsocket.js +14 -16
- package/target/test/xhrCore/FakeWebsocket.js.map +1 -1
- package/target/test/xhrCore/FileUploadTest.spec.js +46 -77
- package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
- package/target/test/xhrCore/OamSubmitTest.spec.js +49 -80
- package/target/test/xhrCore/OamSubmitTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js +37 -68
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest.spec.js +170 -147
- package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest_23.spec.js +93 -140
- package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest.spec.js +122 -91
- package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest23.spec.js +114 -83
- package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
- package/target/test/xhrCore/ShadowDomTest.spec.js +30 -61
- package/target/test/xhrCore/ShadowDomTest.spec.js.map +1 -1
- package/target/test/xhrCore/WebsocketTest.js +60 -93
- package/target/test/xhrCore/WebsocketTest.js.map +1 -1
- package/target/test/xhrCore/XhrFormDataTest.spec.js +41 -15
- package/target/test/xhrCore/XhrFormDataTest.spec.js.map +1 -1
|
@@ -16,28 +16,23 @@ exports.StateHolder = void 0;
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
const Const_1 = require("./Const");
|
|
20
20
|
/**
|
|
21
21
|
* a helper class to isolate the
|
|
22
22
|
* view state and client window and other
|
|
23
23
|
* future states which follow a similar pattern
|
|
24
24
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
class StateHolder {
|
|
26
|
+
constructor(id, value) {
|
|
27
27
|
this.id = id;
|
|
28
28
|
this.value = value;
|
|
29
|
-
|
|
29
|
+
let viewStatePos = id.indexOf(Const_1.P_VIEWSTATE);
|
|
30
30
|
this.nameSpace = viewStatePos > 0 ? id.substr(0, viewStatePos - 1) : Const_1.EMPTY_STR;
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
enumerable: false,
|
|
38
|
-
configurable: true
|
|
39
|
-
});
|
|
40
|
-
return StateHolder;
|
|
41
|
-
}());
|
|
32
|
+
get hasNameSpace() {
|
|
33
|
+
var _a;
|
|
34
|
+
return !!((_a = this === null || this === void 0 ? void 0 : this.nameSpace) !== null && _a !== void 0 ? _a : Const_1.EMPTY_STR).length;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
42
37
|
exports.StateHolder = StateHolder;
|
|
43
38
|
//# sourceMappingURL=ImplTypes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImplTypes.js","sourceRoot":"","sources":["../../../src/main/typescript/impl/core/ImplTypes.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,
|
|
1
|
+
{"version":3,"file":"ImplTypes.js","sourceRoot":"","sources":["../../../src/main/typescript/impl/core/ImplTypes.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,mCAA+C;AAS/C;;;;GAIG;AACH,MAAa,WAAW;IAIpB,YAAmB,EAAU,EAAS,KAAa;QAAhC,OAAE,GAAF,EAAE,CAAQ;QAAS,UAAK,GAAL,KAAK,CAAQ;QAC/C,IAAI,YAAY,GAAG,EAAE,CAAC,OAAO,CAAC,mBAAW,CAAC,CAAC;QAC3C,IAAI,CAAC,SAAS,GAAG,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAS,CAAC;IACnF,CAAC;IAED,IAAI,YAAY;;QACZ,OAAO,CAAC,CAAC,CAAC,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS,mCAAI,iBAAS,CAAC,CAAC,MAAM,CAAC;IACnD,CAAC;CACJ;AAZD,kCAYC"}
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.Messages = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
class Messages {
|
|
20
|
+
constructor() {
|
|
21
21
|
this.MSG_TEST = "Testmessage";
|
|
22
22
|
/*Messages*/
|
|
23
23
|
/** @constant */
|
|
@@ -108,7 +108,6 @@ var Messages = /** @class */ (function () {
|
|
|
108
108
|
/** @constant */
|
|
109
109
|
this.UNKNOWN = "UNKNOWN";
|
|
110
110
|
}
|
|
111
|
-
|
|
112
|
-
}());
|
|
111
|
+
}
|
|
113
112
|
exports.Messages = Messages;
|
|
114
113
|
//# sourceMappingURL=Messages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Messages.js","sourceRoot":"","sources":["../../../src/main/typescript/impl/i18n/Messages.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;
|
|
1
|
+
{"version":3,"file":"Messages.js","sourceRoot":"","sources":["../../../src/main/typescript/impl/i18n/Messages.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,MAAa,QAAQ;IAArB;QACI,aAAQ,GAAG,aAAa,CAAC;QAEzB,YAAY;QACZ,gBAAgB;QAChB,iBAAY,GAAG,+EAA+E;YAC1F,uCAAuC,CAAC;QAC5C,gBAAgB;QAChB,uBAAkB,GAAG,iBAAiB,CAAC;QACvC,gBAAgB;QAChB,wBAAmB,GAAG,kBAAkB,CAAC;QACzC,gBAAgB;QAChB,mBAAc,GAAG,aAAa,CAAC;QAC/B,gBAAgB;QAChB,sBAAiB,GAAG,gBAAgB,CAAC;QACrC,gBAAgB;QAChB,0BAAqB,GAAG,oBAAoB,CAAC;QAE7C,gBAAgB;QAChB,mBAAc,GAAG,oBAAoB,CAAC;QACtC,gBAAgB;QAChB,iBAAY,GAAG,eAAe,CAAC;QAC/B,gBAAgB;QAChB,qBAAgB,GAAG,oBAAoB,CAAC;QAExC,uBAAuB;QACvB,gBAAgB;QAChB,aAAQ,GAAG,iMAAiM,CAAC;QAC7M,gBAAgB;QAChB,kBAAa,GAAG,gDAAgD,CAAC;QACjE,gBAAgB;QAChB,kBAAa,GAAG,mCAAmC,CAAC;QACpD,gBAAgB;QAChB,iBAAY,GAAG,4EAA4E,CAAC;QAC5F,gBAAgB;QAChB,kBAAa,GAAG,oFAA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BAAW,GAAG,2BAA2B,CAAC;QAE1C,gBAAgB;QAChB,2BAAsB,GAAG,oCAAoC,CAAC;QAE9D,gBAAgB;QAChB,oBAAe,GAAG,+CAA+C,CAAC;QAElE,gBAAgB;QAChB,YAAO,GAAG,SAAS,CAAC;IACxB,CAAC;CAAA;AArGD,4BAqGC"}
|
|
@@ -16,11 +16,9 @@ exports.Assertions = void 0;
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var makeException = Lang_1.ExtLang.makeException;
|
|
23
|
-
var Const_1 = require("../core/Const");
|
|
19
|
+
const mona_dish_1 = require("mona-dish");
|
|
20
|
+
const Const_1 = require("../core/Const");
|
|
21
|
+
const Lang_1 = require("./Lang");
|
|
24
22
|
/**
|
|
25
23
|
* a set of internal code assertions
|
|
26
24
|
* which raise an error
|
|
@@ -35,12 +33,12 @@ var Assertions;
|
|
|
35
33
|
assertFunction(options.getIf(Const_1.ON_EVENT).value);
|
|
36
34
|
//improve the error messages if an empty elem is passed
|
|
37
35
|
//Assertions.assertElementExists(elem);
|
|
38
|
-
assert(elem.isPresent(), getMessage("ERR_MUST_BE_PROVIDED1", "{0}: source must be provided or exist", "source element id"), "faces.ajax.request", "ArgNotSet");
|
|
36
|
+
assert(elem.isPresent(), Lang_1.ExtLang.getMessage("ERR_MUST_BE_PROVIDED1", "{0}: source must be provided or exist", "source element id"), "faces.ajax.request", "ArgNotSet");
|
|
39
37
|
}
|
|
40
38
|
Assertions.assertRequestIntegrity = assertRequestIntegrity;
|
|
41
39
|
function assertUrlExists(node) {
|
|
42
40
|
if (node.attr(Const_1.ATTR_URL).isAbsent()) {
|
|
43
|
-
throw Assertions.raiseError(new Error(), getMessage("ERR_RED_URL", null, "processRedirect"), "processRedirect");
|
|
41
|
+
throw Assertions.raiseError(new Error(), Lang_1.ExtLang.getMessage("ERR_RED_URL", null, "processRedirect"), "processRedirect");
|
|
44
42
|
}
|
|
45
43
|
}
|
|
46
44
|
Assertions.assertUrlExists = assertUrlExists;
|
|
@@ -65,41 +63,39 @@ var Assertions;
|
|
|
65
63
|
* @param name the name of the error (optional)
|
|
66
64
|
*/
|
|
67
65
|
function raiseError(error, message, caller, title, name) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
let finalTitle = title !== null && title !== void 0 ? title : Const_1.MALFORMEDXML;
|
|
67
|
+
let finalName = name !== null && name !== void 0 ? name : Const_1.MALFORMEDXML;
|
|
68
|
+
let finalMessage = message !== null && message !== void 0 ? message : Const_1.EMPTY_STR;
|
|
71
69
|
//TODO clean up the messy makeException, this is a perfect case for encapsulation and sane defaults
|
|
72
|
-
return makeException(error, finalTitle, finalName, "Response", caller || ((arguments.caller) ? arguments.caller.toString() : "_raiseError"), finalMessage);
|
|
70
|
+
return Lang_1.ExtLang.makeException(error, finalTitle, finalName, "Response", caller || ((arguments.caller) ? arguments.caller.toString() : "_raiseError"), finalMessage);
|
|
73
71
|
}
|
|
74
72
|
Assertions.raiseError = raiseError;
|
|
75
73
|
/*
|
|
76
74
|
* using the new typescript 3.7 compiler assertion functionality to improve compiler hinting
|
|
77
75
|
* we are not fully there yet, but soon
|
|
78
76
|
*/
|
|
79
|
-
function assert(value, msg, caller, title) {
|
|
80
|
-
if (msg === void 0) { msg = Const_1.EMPTY_STR; }
|
|
81
|
-
if (caller === void 0) { caller = Const_1.EMPTY_STR; }
|
|
82
|
-
if (title === void 0) { title = "Assertion Error"; }
|
|
77
|
+
function assert(value, msg = Const_1.EMPTY_STR, caller = Const_1.EMPTY_STR, title = "Assertion Error") {
|
|
83
78
|
if (!value) {
|
|
84
79
|
throw Assertions.raiseError(new Error(), msg, caller, title);
|
|
85
80
|
}
|
|
86
81
|
}
|
|
87
82
|
Assertions.assert = assert;
|
|
88
|
-
function assertType(value, theType, msg, caller, title) {
|
|
89
|
-
if (msg === void 0) { msg = Const_1.EMPTY_STR; }
|
|
90
|
-
if (caller === void 0) { caller = Const_1.EMPTY_STR; }
|
|
91
|
-
if (title === void 0) { title = "Type Assertion Error"; }
|
|
83
|
+
function assertType(value, theType, msg = Const_1.EMPTY_STR, caller = Const_1.EMPTY_STR, title = "Type Assertion Error") {
|
|
92
84
|
if ((!!value) && !mona_dish_1.Lang.assertType(value, theType)) {
|
|
93
85
|
throw Assertions.raiseError(new Error(), msg, caller, title);
|
|
94
86
|
}
|
|
95
87
|
}
|
|
96
88
|
Assertions.assertType = assertType;
|
|
97
|
-
function assertFunction(value, msg, caller, title) {
|
|
98
|
-
if (msg === void 0) { msg = Const_1.EMPTY_STR; }
|
|
99
|
-
if (caller === void 0) { caller = Const_1.EMPTY_STR; }
|
|
100
|
-
if (title === void 0) { title = "Assertion Error"; }
|
|
89
|
+
function assertFunction(value, msg = Const_1.EMPTY_STR, caller = Const_1.EMPTY_STR, title = "Assertion Error") {
|
|
101
90
|
assertType(value, "function", msg, caller, title);
|
|
102
91
|
}
|
|
103
92
|
Assertions.assertFunction = assertFunction;
|
|
93
|
+
function assertDelay(value) {
|
|
94
|
+
if (!(value >= 0)) { // >= 0 abbreviation which covers all cases of non positive values,
|
|
95
|
+
// including NaN and non numeric strings, no type equality is deliberate here,
|
|
96
|
+
throw new Error("Invalid delay value: " + value);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
Assertions.assertDelay = assertDelay;
|
|
104
100
|
})(Assertions = exports.Assertions || (exports.Assertions = {}));
|
|
105
101
|
//# sourceMappingURL=Assertions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Assertions.js","sourceRoot":"","sources":["../../../src/main/typescript/impl/util/Assertions.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,
|
|
1
|
+
{"version":3,"file":"Assertions.js","sourceRoot":"","sources":["../../../src/main/typescript/impl/util/Assertions.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,y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KAAK,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;SAChE;IACL,CAAC;IAJe,qBAAU,aAIzB,CAAA;IAED,SAAgB,cAAc,CAAC,KAAU,EAAE,GAAG,GAAG,iBAAS,EAAE,MAAM,GAAC,iBAAS,EAAE,KAAK,GAAC,iBAAiB;QACjG,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACtD,CAAC;IAFe,yBAAc,iBAE7B,CAAA;IAED,SAAgB,WAAW,CAAC,KAAU;QAClC,IAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,EAAE,EAAE,mEAAmE;YACnF,8EAA8E;YAC9E,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,KAAK,CAAC,CAAC;SACpD;IACL,CAAC;IALe,sBAAW,cAK1B,CAAA;AACL,CAAC,EA9Ea,UAAU,GAAV,kBAAU,KAAV,kBAAU,QA8EvB"}
|
|
@@ -12,20 +12,16 @@ exports.AsynchronousQueue = void 0;
|
|
|
12
12
|
* This interface can be used as wrapper contract
|
|
13
13
|
* for normal promises if needed.
|
|
14
14
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
class AsynchronousQueue {
|
|
16
|
+
constructor() {
|
|
17
17
|
this.runnableQueue = [];
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
enumerable: false,
|
|
27
|
-
configurable: true
|
|
28
|
-
});
|
|
19
|
+
/**
|
|
20
|
+
* simple is empty accessor, returns true if queue is empty atm
|
|
21
|
+
*/
|
|
22
|
+
get isEmpty() {
|
|
23
|
+
return !this.runnableQueue.length;
|
|
24
|
+
}
|
|
29
25
|
/**
|
|
30
26
|
* enqueues an element and starts the
|
|
31
27
|
* asynchronous work loop if not already running
|
|
@@ -33,40 +29,38 @@ var AsynchronousQueue = /** @class */ (function () {
|
|
|
33
29
|
* @param element the element to be queued and processed
|
|
34
30
|
* @param delay possible delay after our usual process or drop if something newer is incoming algorithm
|
|
35
31
|
*/
|
|
36
|
-
|
|
37
|
-
var _this = this;
|
|
38
|
-
if (delay === void 0) { delay = 0; }
|
|
32
|
+
enqueue(element, delay = 0) {
|
|
39
33
|
if (this.delayTimeout) {
|
|
40
34
|
clearTimeout(this.delayTimeout);
|
|
41
35
|
this.delayTimeout = null;
|
|
42
36
|
}
|
|
43
37
|
if (delay) {
|
|
44
|
-
this.delayTimeout = setTimeout(
|
|
45
|
-
|
|
38
|
+
this.delayTimeout = setTimeout(() => {
|
|
39
|
+
this.appendElement(element);
|
|
46
40
|
});
|
|
47
41
|
}
|
|
48
42
|
else {
|
|
49
43
|
this.appendElement(element);
|
|
50
44
|
}
|
|
51
|
-
}
|
|
45
|
+
}
|
|
52
46
|
/**
|
|
53
47
|
* fetches the next element from the queue (first in first out order)
|
|
54
48
|
*/
|
|
55
|
-
|
|
49
|
+
dequeue() {
|
|
56
50
|
return this.runnableQueue.shift();
|
|
57
|
-
}
|
|
51
|
+
}
|
|
58
52
|
/**
|
|
59
53
|
* clears up all elements from the queue
|
|
60
54
|
*/
|
|
61
|
-
|
|
55
|
+
cleanup() {
|
|
62
56
|
this.currentlyRunning = null;
|
|
63
57
|
this.runnableQueue.length = 0;
|
|
64
|
-
}
|
|
58
|
+
}
|
|
65
59
|
/**
|
|
66
60
|
* cancels the currently running element and then cleans up the queue
|
|
67
61
|
* aka cancel the queue entirely
|
|
68
62
|
*/
|
|
69
|
-
|
|
63
|
+
cancel() {
|
|
70
64
|
try {
|
|
71
65
|
if (this.currentlyRunning) {
|
|
72
66
|
this.currentlyRunning.cancel();
|
|
@@ -75,11 +69,11 @@ var AsynchronousQueue = /** @class */ (function () {
|
|
|
75
69
|
finally {
|
|
76
70
|
this.cleanup();
|
|
77
71
|
}
|
|
78
|
-
}
|
|
79
|
-
|
|
72
|
+
}
|
|
73
|
+
callForNextElementToProcess() {
|
|
80
74
|
this.runEntry();
|
|
81
|
-
}
|
|
82
|
-
|
|
75
|
+
}
|
|
76
|
+
appendElement(element) {
|
|
83
77
|
//only if the first element is added we start with a trigger
|
|
84
78
|
//otherwise a process already is running and not finished yet at that
|
|
85
79
|
//time
|
|
@@ -87,19 +81,18 @@ var AsynchronousQueue = /** @class */ (function () {
|
|
|
87
81
|
if (!this.currentlyRunning) {
|
|
88
82
|
this.runEntry();
|
|
89
83
|
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
var _this = this;
|
|
84
|
+
}
|
|
85
|
+
runEntry() {
|
|
93
86
|
if (this.isEmpty) {
|
|
94
87
|
this.currentlyRunning = null;
|
|
95
88
|
return;
|
|
96
89
|
}
|
|
97
90
|
this.currentlyRunning = this.dequeue();
|
|
98
91
|
this.currentlyRunning
|
|
99
|
-
.catch(
|
|
92
|
+
.catch((e) => {
|
|
100
93
|
//in case of an error we always clean up the remaining calls
|
|
101
94
|
//to allow a clean recovery of the application
|
|
102
|
-
|
|
95
|
+
this.cleanup();
|
|
103
96
|
throw e;
|
|
104
97
|
})
|
|
105
98
|
.then(
|
|
@@ -109,9 +102,8 @@ var AsynchronousQueue = /** @class */ (function () {
|
|
|
109
102
|
//naturally give we have a DOM, the DOM is the natural event dispatch system
|
|
110
103
|
//which we can use, to decouple the calls from a recursive stack call
|
|
111
104
|
//(the browser engine will take care of that)
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
}());
|
|
105
|
+
() => this.callForNextElementToProcess()).start();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
116
108
|
exports.AsynchronousQueue = AsynchronousQueue;
|
|
117
109
|
//# sourceMappingURL=AsyncQueue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsyncQueue.js","sourceRoot":"","sources":["../../../src/main/typescript/impl/util/AsyncQueue.ts"],"names":[],"mappings":";;;AAiBA;;;;;;;;;;GAUG;AACH;
|
|
1
|
+
{"version":3,"file":"AsyncQueue.js","sourceRoot":"","sources":["../../../src/main/typescript/impl/util/AsyncQueue.ts"],"names":[],"mappings":";;;AAiBA;;;;;;;;;;GAUG;AACH,MAAa,iBAAiB;IAO1B;QALQ,kBAAa,GAAG,EAAE,CAAC;IAM3B,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACP,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;IACtC,CAAC;IAED;;;;;;OAMG;IACH,OAAO,CAAC,OAAU,EAAE,KAAK,GAAG,CAAC;QACzB,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAChC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;SAC5B;QACD,IAAI,KAAK,EAAE;YACP,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,GAAG,EAAE;gBAChC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YAChC,CAAC,CAAQ,CAAC;SACb;aAAM;YACH,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;SAC/B;IACL,CAAC;IAED;;OAEG;IACH,OAAO;QACH,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,OAAO;QACH,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;IAClC,CAAC;IAED;;;OAGG;IACH,MAAM;QACF,IAAI;YACA,IAAI,IAAI,CAAC,gBAAgB,EAAE;gBACvB,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;aAClC;SACJ;gBAAS;YACN,IAAI,CAAC,OAAO,EAAE,CAAC;SAClB;IACL,CAAC;IAEO,2BAA2B;QAC/B,IAAI,CAAC,QAAQ,EAAE,CAAC;IACpB,CAAC;IAEO,aAAa,CAAC,OAAU;QAC5B,4DAA4D;Q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