jsf.js_next_gen 4.0.0-beta-23 → 4.0.1-alpha.0
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/.nyc_output/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
- package/.nyc_output/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
- package/.nyc_output/processinfo/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
- package/.nyc_output/processinfo/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -1
- package/README.md +13 -21
- package/dist/docs/assets/main.js +56 -52
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/assets/style.css +23 -0
- package/dist/docs/functions/faces.ajax.addOnError.html +2 -0
- package/dist/docs/functions/faces.ajax.addOnEvent.html +2 -0
- package/dist/docs/functions/faces.push.close.html +4 -2
- package/dist/docs/functions/faces.push.init.html +19 -7
- package/dist/docs/functions/faces.push.open.html +4 -2
- package/dist/docs/functions/myfaces.ab.html +9 -4
- package/dist/docs/functions/myfaces.onDomReady.html +72 -0
- package/dist/docs/index.html +16 -18
- package/dist/docs/modules/myfaces.html +3 -1
- package/dist/docs/variables/myfaces.oam.html +2 -1
- package/dist/window/faces-development.js +2846 -2085
- 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.LICENSE.txt +17 -2
- 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 +2856 -2084
- 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.LICENSE.txt +17 -2
- 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 +19 -18
- package/plans for 4.0.1.txt +8 -0
- package/src/main/test.xml +23 -0
- package/src/main/typescript/@types/definitions/index.d.ts +19 -2
- package/src/main/typescript/api/_api.ts +68 -25
- package/src/main/typescript/api/jsf.ts +18 -0
- package/src/main/typescript/impl/AjaxImpl.ts +204 -100
- package/src/main/typescript/impl/PushImpl.ts +63 -38
- package/src/main/typescript/impl/core/Const.ts +56 -40
- package/src/main/typescript/impl/util/Assertions.ts +16 -8
- package/src/main/typescript/impl/util/AsyncRunnable.ts +85 -10
- package/src/main/typescript/impl/util/ExtDomQuery.ts +65 -54
- package/src/main/typescript/impl/util/FileUtils.ts +108 -0
- package/src/main/typescript/impl/util/HiddenInputBuilder.ts +93 -0
- package/src/main/typescript/impl/util/Lang.ts +91 -35
- package/src/main/typescript/impl/util/XhrQueueController.ts +112 -0
- package/src/main/typescript/impl/xhrCore/ErrorData.ts +15 -10
- package/src/main/typescript/impl/xhrCore/EventData.ts +3 -3
- package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +25 -11
- package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +78 -32
- package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +10 -10
- package/src/main/typescript/impl/xhrCore/Response.ts +66 -49
- package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +211 -138
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +92 -166
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +111 -120
- package/src/main/typescript/myfaces/OamSubmit.ts +30 -14
- package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +163 -27
- package/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.ts +4 -4
- package/src/main/typescript/test/frameworkBase/_ext/monadish/fixtures/blank.css +0 -0
- package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.ts +921 -0
- package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.ts +108 -0
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +111 -3
- package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +40 -1
- package/src/main/typescript/test/frameworkBase/_ext/shared/fixtures/jakarta.faces.resource/faces.js.jsf +0 -0
- package/src/main/typescript/test/impl/ImplTest.spec.ts +3 -3
- package/src/main/typescript/test/impl/ImplTest_23.spec.ts +3 -7
- package/src/main/typescript/test/myfaces/OnLoadSpec.ts +52 -0
- package/src/main/typescript/test/queue/AsynchronousProbe.ts +5 -5
- package/src/main/typescript/test/queue/AsynchronousQueueTest.spec.ts +4 -3
- package/src/main/typescript/test/xhrCore/EventTests.spec.ts +28 -22
- package/src/main/typescript/test/xhrCore/FileUploadTest.spec.ts +5 -2
- package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +203 -0
- package/src/main/typescript/test/xhrCore/OamSubmitTest.spec.ts +177 -0
- package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +158 -17
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +320 -15
- package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +45 -4
- package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +374 -35
- package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +43 -9
- package/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.ts +109 -0
- package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +67 -49
- package/src/main/typescript/test.xml +6 -0
- package/src/main/typescript/tsconfig.json +1 -1
- package/src/test/resources/jsf-development.js +1 -1
- package/src/tmp/test.html +12 -88
- package/target/api/_api.js +63 -21
- package/target/api/_api.js.map +1 -1
- package/target/api/jsf.js +11 -0
- package/target/api/jsf.js.map +1 -1
- package/target/classes/com/example/jsfs_js_ts/DecoratedFacesJS.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/DecoratingResourceHandlerWrapper.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/FacesJSMapFileResourceWrapper.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/FacesJSMappingDecorator.class +0 -0
- package/target/impl/AjaxImpl.js +177 -81
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/PushImpl.js +66 -35
- package/target/impl/PushImpl.js.map +1 -1
- package/target/impl/core/Const.js +54 -39
- package/target/impl/core/Const.js.map +1 -1
- package/target/impl/core/Context.js +10 -0
- package/target/impl/core/Context.js.map +1 -0
- package/target/impl/util/Assertions.js +12 -7
- package/target/impl/util/Assertions.js.map +1 -1
- package/target/impl/util/AsyncQueue.js.map +1 -1
- package/target/impl/util/AsyncRunnable.js +60 -0
- package/target/impl/util/AsyncRunnable.js.map +1 -1
- package/target/impl/util/ExtDomQuery.js +66 -48
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/impl/util/FileUtils.js +97 -0
- package/target/impl/util/FileUtils.js.map +1 -0
- package/target/impl/util/HiddenElementBuilder.js +7 -0
- package/target/impl/util/HiddenElementBuilder.js.map +1 -0
- package/target/impl/util/HiddenInputBuilder.js +83 -0
- package/target/impl/util/HiddenInputBuilder.js.map +1 -0
- package/target/{types/index.js → impl/util/IAsyncRunnable.js} +11 -2
- package/target/impl/util/IAsyncRunnable.js.map +1 -0
- package/target/impl/util/Lang.js +81 -31
- package/target/impl/util/Lang.js.map +1 -1
- package/target/impl/util/URLCodec.js +77 -0
- package/target/impl/util/URLCodec.js.map +1 -0
- package/target/impl/util/XhrQueueController.js +107 -0
- package/target/impl/util/XhrQueueController.js.map +1 -0
- package/target/impl/xhrCore/ErrorData.js +10 -8
- package/target/impl/xhrCore/ErrorData.js.map +1 -1
- package/target/impl/xhrCore/EventData.js +2 -2
- package/target/impl/xhrCore/EventData.js.map +1 -1
- package/target/impl/xhrCore/RequestContext.js +11 -0
- package/target/impl/xhrCore/RequestContext.js.map +1 -0
- package/target/impl/xhrCore/RequestDataResolver.js +70 -23
- package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
- package/target/impl/xhrCore/ResonseDataResolver.js +9 -9
- package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
- package/target/impl/xhrCore/Response.js +44 -29
- package/target/impl/xhrCore/Response.js.map +1 -1
- package/target/impl/xhrCore/ResponseProcessor.js +187 -119
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +82 -156
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrQueHandler.js +11 -0
- package/target/impl/xhrCore/XhrQueHandler.js.map +1 -0
- package/target/impl/xhrCore/XhrQueueController.js +62 -0
- package/target/impl/xhrCore/XhrQueueController.js.map +1 -0
- package/target/impl/xhrCore/XhrRequest.js +94 -106
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/myfaces/OamSubmit.js +25 -14
- package/target/myfaces/OamSubmit.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +124 -23
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js +76 -0
- package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js.map +1 -0
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +4 -4
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js +925 -0
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js.map +1 -0
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js +112 -0
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js.map +1 -0
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +103 -3
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js +37 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
- package/target/test/impl/ImplTest.spec.js +2 -2
- package/target/test/impl/ImplTest.spec.js.map +1 -1
- package/target/test/impl/ImplTest_23.spec.js +2 -2
- package/target/test/impl/ImplTest_23.spec.js.map +1 -1
- package/target/test/myfaces/OnLoadSpec.js +57 -0
- package/target/test/myfaces/OnLoadSpec.js.map +1 -0
- package/target/test/queue/AsynchronousQueueTest.spec.js +3 -3
- package/target/test/queue/AsynchronousQueueTest.spec.js.map +1 -1
- package/target/test/xhrCore/EventTests.spec.js +26 -19
- package/target/test/xhrCore/EventTests.spec.js.map +1 -1
- package/target/test/xhrCore/FileUploadTest.spec.js +2 -1
- package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
- package/target/test/xhrCore/NamespacesRequestTest.spec.js +204 -0
- package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -0
- package/target/test/xhrCore/OamSubmitTest.spec.js +180 -0
- package/target/test/xhrCore/OamSubmitTest.spec.js.map +1 -0
- package/target/test/xhrCore/RequestParamsTest.spec.js +142 -10
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest.spec.js +288 -11
- package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest_23.spec.js +40 -2
- package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest.spec.js +315 -24
- package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest23.spec.js +38 -8
- package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
- package/target/test/xhrCore/TobagoFileUploadTest.spec.js +128 -0
- package/target/test/xhrCore/TobagoFileUploadTest.spec.js.map +1 -0
- package/target/test/xhrCore/XhrFormDataTest.spec.js +57 -34
- package/target/test/xhrCore/XhrFormDataTest.spec.js.map +1 -1
- package/target/test-classes/.gz +0 -0
- package/target/test-classes/com/example/jsfs_js_ts/JsfsJsTsApplicationTests.class +0 -0
- package/target/test-classes/fileuploadtest.html +24 -0
- package/target/test-classes/jsf-development.js +3559 -0
- package/target/test-classes/jsf-development.js.br +0 -0
- package/target/test-classes/jsf-development.js.gz +0 -0
- package/target/test-classes/jsf-development.js.map +1 -0
- package/target/test-classes/jsf.js +3 -0
- package/target/test-classes/jsf.js.br +0 -0
- package/target/test-classes/jsf.js.gz +0 -0
- package/tmp.xml +36 -0
- package/.nyc_output/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
- package/.nyc_output/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
- package/.nyc_output/processinfo/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
- package/.nyc_output/processinfo/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
- package/src/main/typescript/impl/util/AsyncQueue.ts +0 -133
- package/src/main/typescript/test/frameworkBase/_ext/monadish/StreamTest.spec.ts +0 -231
- package/target/types/index.js.map +0 -1
|
@@ -15,25 +15,21 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* Typescript port of the faces
|
|
18
|
+
* Typescript port of the faces\.push part in the myfaces implementation
|
|
19
19
|
*/
|
|
20
|
-
|
|
21
|
-
//TODO still work in progress
|
|
22
|
-
//this is a 1:1 port for the time being
|
|
23
20
|
import {MAX_RECONNECT_ATTEMPTS, REASON_EXPIRED, RECONNECT_INTERVAL} from "./core/Const";
|
|
24
|
-
;
|
|
25
|
-
|
|
21
|
+
import {DQ} from "mona-dish";
|
|
26
22
|
|
|
27
23
|
/**
|
|
28
24
|
* Implementation class for the push functionality
|
|
29
25
|
*/
|
|
30
26
|
export module PushImpl {
|
|
31
27
|
|
|
32
|
-
const URL_PROTOCOL =
|
|
28
|
+
const URL_PROTOCOL = DQ.global().location.protocol.replace("http", "ws") + "//";
|
|
33
29
|
|
|
34
30
|
|
|
35
|
-
//we expose the member variables for testing purposes
|
|
36
|
-
//they are not directly touched outside of tests
|
|
31
|
+
// we expose the member variables for testing purposes
|
|
32
|
+
// they are not directly touched outside of tests
|
|
37
33
|
|
|
38
34
|
/* socket map by token */
|
|
39
35
|
export let sockets = {};
|
|
@@ -43,7 +39,7 @@ export module PushImpl {
|
|
|
43
39
|
export let clientIdsByTokens = {};
|
|
44
40
|
|
|
45
41
|
|
|
46
|
-
//needed for testing
|
|
42
|
+
// needed for testing
|
|
47
43
|
export function reset() {
|
|
48
44
|
sockets = {};
|
|
49
45
|
components = {}
|
|
@@ -55,58 +51,64 @@ export module PushImpl {
|
|
|
55
51
|
*/
|
|
56
52
|
|
|
57
53
|
/**
|
|
58
|
-
*
|
|
59
|
-
* @param
|
|
60
|
-
* @param
|
|
61
|
-
* @param
|
|
62
|
-
* @param
|
|
54
|
+
* @param socketClientId the sockets client identifier
|
|
55
|
+
* @param url the uri to reach the socket
|
|
56
|
+
* @param channel the channel name/id
|
|
57
|
+
* @param onopen The function to be invoked when the web socket is opened.
|
|
58
|
+
* @param onmessage The function to be invoked when a message is received.
|
|
59
|
+
* @param onerror The function to be invoked when an error occurs.
|
|
60
|
+
* @param onclose The function to be invoked when the web socket is closed.
|
|
61
|
+
* @param behaviors functions which are invoked whenever a message is received
|
|
62
|
+
* @param autoConnect Whether or not to automatically open the socket. Defaults to <code>false</code>.
|
|
63
63
|
*/
|
|
64
64
|
export function init(socketClientId: string,
|
|
65
|
-
|
|
65
|
+
url: string,
|
|
66
66
|
channel: string,
|
|
67
67
|
onopen: Function,
|
|
68
68
|
onmessage: Function,
|
|
69
|
+
onerror: Function,
|
|
69
70
|
onclose: Function,
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
behaviors: any,
|
|
72
|
+
autoConnect: boolean) {
|
|
72
73
|
onclose = resolveFunction(onclose);
|
|
73
74
|
|
|
74
|
-
if (!
|
|
75
|
+
if (!DQ.global().WebSocket) { // IE6-9.
|
|
75
76
|
onclose(-1, channel);
|
|
76
77
|
return;
|
|
77
78
|
}
|
|
78
79
|
|
|
79
|
-
let channelToken =
|
|
80
|
+
let channelToken = url.substr(url.indexOf('?') + 1);
|
|
80
81
|
|
|
81
82
|
if (!components[socketClientId]) {
|
|
82
83
|
components[socketClientId] = {
|
|
83
84
|
'channelToken': channelToken,
|
|
84
85
|
'onopen': resolveFunction(onopen),
|
|
85
86
|
'onmessage' : resolveFunction(onmessage),
|
|
87
|
+
'onerror' : resolveFunction(onerror),
|
|
86
88
|
'onclose': onclose,
|
|
87
|
-
'behaviors':
|
|
88
|
-
'autoconnect':
|
|
89
|
+
'behaviors': behaviors,
|
|
90
|
+
'autoconnect': autoConnect};
|
|
89
91
|
if (!clientIdsByTokens[channelToken]) {
|
|
90
92
|
clientIdsByTokens[channelToken] = [];
|
|
91
93
|
}
|
|
92
94
|
clientIdsByTokens[channelToken].push(socketClientId);
|
|
93
95
|
if (!sockets[channelToken]){
|
|
94
96
|
sockets[channelToken] = new Socket(channelToken,
|
|
95
|
-
getBaseURL(
|
|
97
|
+
getBaseURL(url), channel);
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
100
|
|
|
99
|
-
if (
|
|
100
|
-
(
|
|
101
|
+
if (autoConnect) {
|
|
102
|
+
(DQ.global()?.faces ?? DQ.global()?.jsf).push.open(socketClientId);
|
|
101
103
|
}
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
export function open(socketClientId: string) {
|
|
105
|
-
getSocket(components
|
|
107
|
+
getSocket(components[socketClientId]?.channelToken).open();
|
|
106
108
|
}
|
|
107
109
|
|
|
108
110
|
export function close(socketClientId: string) {
|
|
109
|
-
getSocket(components
|
|
111
|
+
getSocket(components[socketClientId].channelToken).close();
|
|
110
112
|
}
|
|
111
113
|
|
|
112
114
|
// Private helper classes
|
|
@@ -138,29 +140,51 @@ export module PushImpl {
|
|
|
138
140
|
this.bindCallbacks();
|
|
139
141
|
}
|
|
140
142
|
|
|
143
|
+
// noinspection JSUnusedLocalSymbols
|
|
141
144
|
onopen(event: any) {
|
|
142
145
|
if (!this.reconnectAttempts) {
|
|
143
146
|
let clientIds = clientIdsByTokens[this.channelToken];
|
|
144
147
|
for (let i = clientIds.length - 1; i >= 0; i--) {
|
|
145
148
|
let socketClientId = clientIds[i];
|
|
146
|
-
components[socketClientId]['onopen'](this.channel);
|
|
149
|
+
components[socketClientId]?.['onopen']?.(this.channel);
|
|
147
150
|
}
|
|
148
151
|
}
|
|
149
152
|
this.reconnectAttempts = 0;
|
|
150
153
|
}
|
|
151
154
|
|
|
155
|
+
onerror(event: any) {
|
|
156
|
+
let message = JSON.parse(event.data);
|
|
157
|
+
//TODO replace this with a more readable Stream code
|
|
158
|
+
for (let i = clientIdsByTokens[this.channelToken].length - 1; i >= 0; i--) {
|
|
159
|
+
let socketClientId = clientIdsByTokens[this.channelToken][i];
|
|
160
|
+
if (document.getElementById(socketClientId)) {
|
|
161
|
+
try {
|
|
162
|
+
components[socketClientId]?.['onerror']?.(message, this.channel, event);
|
|
163
|
+
} catch (e) {
|
|
164
|
+
//Ignore
|
|
165
|
+
}
|
|
166
|
+
} else {
|
|
167
|
+
clientIdsByTokens[this.channelToken].splice(i, 1);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (clientIdsByTokens[this.channelToken].length == 0) {
|
|
171
|
+
// tag disappeared
|
|
172
|
+
this.close();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
152
176
|
onmmessage(event: any) {
|
|
153
177
|
let message = JSON.parse(event.data);
|
|
154
178
|
for (let i = clientIdsByTokens[this.channelToken].length - 1; i >= 0; i--) {
|
|
155
179
|
let socketClientId = clientIdsByTokens[this.channelToken][i];
|
|
156
180
|
if (document.getElementById(socketClientId)) {
|
|
157
181
|
try {
|
|
158
|
-
components[socketClientId]['onmessage'](message, this.channel, event);
|
|
182
|
+
components[socketClientId]?.['onmessage']?.(message, this.channel, event);
|
|
159
183
|
} catch (e) {
|
|
160
184
|
//Ignore
|
|
161
185
|
}
|
|
162
|
-
let behaviors = components[socketClientId]['behaviors'];
|
|
163
|
-
let functions = behaviors[message];
|
|
186
|
+
let behaviors = components?.[socketClientId]?.['behaviors'];
|
|
187
|
+
let functions = behaviors?.[message];
|
|
164
188
|
if (functions && functions.length) {
|
|
165
189
|
for (let j = 0; j < functions.length; j++) {
|
|
166
190
|
try {
|
|
@@ -175,7 +199,7 @@ export module PushImpl {
|
|
|
175
199
|
}
|
|
176
200
|
}
|
|
177
201
|
if (clientIdsByTokens[this.channelToken].length == 0) {
|
|
178
|
-
//tag
|
|
202
|
+
// tag disappeared
|
|
179
203
|
this.close();
|
|
180
204
|
}
|
|
181
205
|
}
|
|
@@ -189,7 +213,7 @@ export module PushImpl {
|
|
|
189
213
|
let clientIds = clientIdsByTokens[this.channelToken];
|
|
190
214
|
for (let i = clientIds.length - 1; i >= 0; i--) {
|
|
191
215
|
let socketClientId = clientIds[i];
|
|
192
|
-
components[socketClientId]['onclose'](event?.code, this?.channel, event);
|
|
216
|
+
components?.[socketClientId]?.['onclose']?.(event?.code, this?.channel, event);
|
|
193
217
|
}
|
|
194
218
|
} else {
|
|
195
219
|
setTimeout(this.open, RECONNECT_INTERVAL * this.reconnectAttempts++);
|
|
@@ -211,6 +235,7 @@ export module PushImpl {
|
|
|
211
235
|
this.socket.onopen = (event: Event) => this.onopen(event);
|
|
212
236
|
this.socket.onmessage = (event: Event) => this.onmmessage(event);
|
|
213
237
|
this.socket.onclose = (event: Event) => this.onclose(event);
|
|
238
|
+
this.socket.onerror = (event: Event) => this.onerror(event);
|
|
214
239
|
}
|
|
215
240
|
}
|
|
216
241
|
|
|
@@ -218,7 +243,7 @@ export module PushImpl {
|
|
|
218
243
|
|
|
219
244
|
function getBaseURL(url: string) {
|
|
220
245
|
if (url.indexOf("://") < 0) {
|
|
221
|
-
let base =
|
|
246
|
+
let base = DQ.global().location.hostname + ":" + DQ.global().location.port;
|
|
222
247
|
return URL_PROTOCOL + base + url;
|
|
223
248
|
} else {
|
|
224
249
|
return url;
|
|
@@ -227,9 +252,9 @@ export module PushImpl {
|
|
|
227
252
|
|
|
228
253
|
/**
|
|
229
254
|
* Get socket associated with given channelToken.
|
|
230
|
-
* @param
|
|
231
|
-
* @return
|
|
232
|
-
* @throws
|
|
255
|
+
* @param channelToken The name of the web socket channelToken.
|
|
256
|
+
* @return Socket associated with given channelToken.
|
|
257
|
+
* @throws Error, when the channelToken is unknown, you may need to initialize
|
|
233
258
|
* it first via <code>init()</code> function.
|
|
234
259
|
*/
|
|
235
260
|
function getSocket(channelToken: string): Socket {
|
|
@@ -243,7 +268,7 @@ export module PushImpl {
|
|
|
243
268
|
|
|
244
269
|
function resolveFunction(fn: Function | string = () => {
|
|
245
270
|
}): Function {
|
|
246
|
-
return <Function>((typeof fn !== "function") && (fn =
|
|
271
|
+
return <Function>((typeof fn !== "function") && (fn = DQ.global()[fn]), fn);
|
|
247
272
|
}
|
|
248
273
|
|
|
249
274
|
}
|
|
@@ -17,9 +17,16 @@
|
|
|
17
17
|
/*
|
|
18
18
|
* [export const] constants
|
|
19
19
|
*/
|
|
20
|
-
|
|
21
|
-
export const
|
|
20
|
+
|
|
21
|
+
export const XML_ATTR_NAMED_VIEWROOT = "namedViewRoot";
|
|
22
|
+
export const NAMED_VIEWROOT = "namedViewRoot";
|
|
23
|
+
|
|
24
|
+
export const P_AJAX_SOURCE = "jakarta.faces.source";
|
|
25
|
+
export const NAMING_CONTAINER_ID = "myfaces.NamingContainerId";
|
|
26
|
+
|
|
27
|
+
export const VIEW_ID = "myfaces.viewId";
|
|
22
28
|
export const P_VIEWSTATE = "jakarta.faces.ViewState";
|
|
29
|
+
export const P_CLIENT_WINDOW = "jakarta.faces.ClientWindow";
|
|
23
30
|
export const P_VIEWROOT = "jakarta.faces.ViewRoot";
|
|
24
31
|
export const P_VIEWHEAD = "jakarta.faces.ViewHead";
|
|
25
32
|
export const P_VIEWBODY = "jakarta.faces.ViewBody";
|
|
@@ -33,7 +40,8 @@ export const EMPTY_FUNC = Object.freeze(() => {
|
|
|
33
40
|
export const EMPTY_STR = "";
|
|
34
41
|
export const EMPTY_MAP = Object.freeze({});
|
|
35
42
|
|
|
36
|
-
export const HTML_VIEWSTATE = ["<input type='hidden'", "
|
|
43
|
+
export const HTML_VIEWSTATE = ["<input type='hidden'", "name='", P_VIEWSTATE, "' value='' />"].join(EMPTY_STR);
|
|
44
|
+
export const HTML_CLIENT_WINDOW = ["<input type='hidden'", "' name='", P_CLIENT_WINDOW, "' value='' />"].join(EMPTY_STR);
|
|
37
45
|
|
|
38
46
|
|
|
39
47
|
/*internal identifiers for options*/
|
|
@@ -46,8 +54,10 @@ export const IDENT_FORM = "@form";
|
|
|
46
54
|
export const P_AJAX = "jakarta.faces.partial.ajax";
|
|
47
55
|
export const P_EXECUTE = "jakarta.faces.partial.execute";
|
|
48
56
|
export const P_RENDER = "jakarta.faces.partial.render";
|
|
57
|
+
/*render override for viewbody or viewroot, in both cases an all is performed*/
|
|
58
|
+
export const P_RENDER_OVERRIDE = "_myfaces.rendeOverride";
|
|
49
59
|
export const P_EVT = "jakarta.faces.partial.event";
|
|
50
|
-
|
|
60
|
+
|
|
51
61
|
export const P_RESET_VALUES = "jakarta.faces.partial.resetValues";
|
|
52
62
|
export const P_WINDOW_ID = "jakarta.faces.windowId";
|
|
53
63
|
|
|
@@ -87,19 +97,18 @@ export const SERVER_ERROR = "serverError";
|
|
|
87
97
|
export const CLIENT_ERROR = "clientError";
|
|
88
98
|
export const TIMEOUT_EVENT = "timeout";
|
|
89
99
|
|
|
90
|
-
export const
|
|
91
|
-
|
|
92
|
-
export const
|
|
93
|
-
export const
|
|
94
|
-
export const
|
|
95
|
-
export const
|
|
96
|
-
export const CTX_PARAM_DELAY = "delay";
|
|
97
|
-
export const CTX_PARAM_TIMEOUT = "timeout";
|
|
98
|
-
export const CTX_PARAM_RST = "resetValues";
|
|
99
|
-
export const CTX_PARAM_EXECUTE = "execute";
|
|
100
|
-
|
|
101
|
-
export const STAGE_DEVELOPMENT = "Development";
|
|
100
|
+
export const CTX_OPTIONS_PARAMS = "params";
|
|
101
|
+
export const CTX_OPTIONS_DELAY = "delay";
|
|
102
|
+
export const DELAY_NONE = 'none';
|
|
103
|
+
export const CTX_OPTIONS_TIMEOUT = "timeout";
|
|
104
|
+
export const CTX_OPTIONS_RESET = "resetValues";
|
|
105
|
+
export const CTX_OPTIONS_EXECUTE = "execute";
|
|
102
106
|
|
|
107
|
+
export const CTX_PARAM_MF_INTERNAL = "myfaces.internal";
|
|
108
|
+
export const CTX_PARAM_SRC_FRM_ID = "myfaces.source.formId";
|
|
109
|
+
export const CTX_PARAM_SRC_CTL_ID = "myfaces.source.controlId";
|
|
110
|
+
export const CTX_PARAM_REQ_PASS_THR = "myfaces.request.passThrough";
|
|
111
|
+
export const CTX_PARAM_PPS = "myfaces.request.pps";
|
|
103
112
|
|
|
104
113
|
export const CONTENT_TYPE = "Content-Type";
|
|
105
114
|
export const HEAD_FACES_REQ = "Faces-Request";
|
|
@@ -116,13 +125,12 @@ export const MULTIPART = "multipart/form-data";
|
|
|
116
125
|
export const NO_TIMEOUT = 0;
|
|
117
126
|
export const STD_ACCEPT = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
|
|
118
127
|
|
|
119
|
-
export const
|
|
120
|
-
export const
|
|
121
|
-
export const
|
|
122
|
-
export const
|
|
123
|
-
export const
|
|
124
|
-
|
|
125
|
-
export const TAG_ATTR = "attribute";
|
|
128
|
+
export const HTML_TAG_HEAD = "HEAD";
|
|
129
|
+
export const HTML_TAG_FORM = "FORM";
|
|
130
|
+
export const HTML_TAG_BODY = "BODY";
|
|
131
|
+
export const HTML_TAG_LINK = "LINK";
|
|
132
|
+
export const HTML_TAG_SCRIPT = "SCRIPT";
|
|
133
|
+
export const HTML_TAG_STYLE = "STYLE";
|
|
126
134
|
|
|
127
135
|
|
|
128
136
|
export const SEL_VIEWSTATE_ELEM = "[name='" + P_VIEWSTATE + "']";
|
|
@@ -134,44 +142,48 @@ export const PHASE_PROCESS_RESPONSE = "processResponse";
|
|
|
134
142
|
|
|
135
143
|
export const ERR_NO_PARTIAL_RESPONSE = "Partial response not set";
|
|
136
144
|
|
|
145
|
+
export const MYFACES_OPTION_PPS = "pps";
|
|
146
|
+
|
|
137
147
|
export const ATTR_URL = "url";
|
|
138
148
|
export const ATTR_NAME = "name";
|
|
139
149
|
export const ATTR_VALUE = "value";
|
|
140
150
|
export const ATTR_ID = "id";
|
|
141
151
|
|
|
142
152
|
/*partial response types*/
|
|
143
|
-
export const
|
|
153
|
+
export const XML_TAG_PARTIAL_RESP = "partial-response";
|
|
144
154
|
|
|
145
155
|
/*partial commands*/
|
|
146
|
-
export const
|
|
147
|
-
export const
|
|
148
|
-
export const
|
|
149
|
-
export const
|
|
150
|
-
export const
|
|
151
|
-
export const
|
|
152
|
-
export const
|
|
153
|
-
export const
|
|
154
|
-
export const
|
|
156
|
+
export const XML_TAG_CHANGES = "changes";
|
|
157
|
+
export const XML_TAG_UPDATE = "update";
|
|
158
|
+
export const XML_TAG_DELETE = "delete";
|
|
159
|
+
export const XML_TAG_INSERT = "insert";
|
|
160
|
+
export const XML_TAG_EVAL = "eval";
|
|
161
|
+
export const XML_TAG_ERROR = "error";
|
|
162
|
+
export const XML_TAG_ATTRIBUTES = "attributes";
|
|
163
|
+
export const XML_TAG_EXTENSION = "extension";
|
|
164
|
+
export const XML_TAG_REDIRECT = "redirect";
|
|
165
|
+
export const XML_TAG_BEFORE = "before";
|
|
166
|
+
export const XML_TAG_AFTER = "after";
|
|
167
|
+
export const XML_TAG_ATTR = "attribute";
|
|
168
|
+
|
|
155
169
|
|
|
156
170
|
/*other constants*/
|
|
157
171
|
|
|
158
|
-
export const UPDATE_FORMS = "
|
|
159
|
-
export const UPDATE_ELEMS = "
|
|
172
|
+
export const UPDATE_FORMS = "myfaces.updateForms";
|
|
173
|
+
export const UPDATE_ELEMS = "myfaces.updateElems";
|
|
160
174
|
|
|
161
175
|
//we want the head elements to be processed before we process the body
|
|
162
176
|
//but after the inner html is done
|
|
163
|
-
export const DEFERRED_HEAD_INSERTS = "
|
|
177
|
+
export const DEFERRED_HEAD_INSERTS = "myfaces.headElems";
|
|
164
178
|
|
|
165
179
|
export const MYFACES = "myfaces";
|
|
166
180
|
|
|
167
|
-
export const SEL_SCRIPTS_STYLES = "script, style, link";
|
|
168
|
-
|
|
169
181
|
export const MF_NONE = "__mf_none__";
|
|
170
182
|
|
|
171
183
|
export const REASON_EXPIRED = "Expired";
|
|
172
184
|
|
|
173
|
-
export const APPLIED_VST = "appliedViewState";
|
|
174
|
-
export const APPLIED_CLIENT_WINDOW = "appliedClientWindow";
|
|
185
|
+
export const APPLIED_VST = "myfaces.appliedViewState";
|
|
186
|
+
export const APPLIED_CLIENT_WINDOW = "myfaces.appliedClientWindow";
|
|
175
187
|
|
|
176
188
|
export const RECONNECT_INTERVAL = 500;
|
|
177
189
|
export const MAX_RECONNECT_ATTEMPTS = 25;
|
|
@@ -186,6 +198,10 @@ export const UNKNOWN = "UNKNOWN";
|
|
|
186
198
|
* changed to a simple value passthrough
|
|
187
199
|
*/
|
|
188
200
|
|
|
201
|
+
export function $faces(): FacesAPI {
|
|
202
|
+
return (window?.faces ?? window?.jsf) as FacesAPI;
|
|
203
|
+
}
|
|
204
|
+
|
|
189
205
|
export function $nsp(inputNamespace?: any): any {
|
|
190
206
|
if((!inputNamespace) || !inputNamespace?.replace) {
|
|
191
207
|
return inputNamespace;
|
|
@@ -16,9 +16,6 @@
|
|
|
16
16
|
import {Config, Lang, XMLQuery} from "mona-dish";
|
|
17
17
|
|
|
18
18
|
import {DQ} from "mona-dish";
|
|
19
|
-
import {ExtLang} from "./Lang";
|
|
20
|
-
import getMessage = ExtLang.getMessage;
|
|
21
|
-
import makeException = ExtLang.makeException;
|
|
22
19
|
import {
|
|
23
20
|
ATTR_URL,
|
|
24
21
|
EMPTY_RESPONSE,
|
|
@@ -26,8 +23,10 @@ import {
|
|
|
26
23
|
ON_ERROR,
|
|
27
24
|
ON_EVENT,
|
|
28
25
|
PHASE_PROCESS_RESPONSE,
|
|
29
|
-
|
|
26
|
+
XML_TAG_PARTIAL_RESP
|
|
30
27
|
} from "../core/Const";
|
|
28
|
+
import {ExtLang} from "./Lang";
|
|
29
|
+
|
|
31
30
|
|
|
32
31
|
/**
|
|
33
32
|
* a set of internal code assertions
|
|
@@ -36,6 +35,8 @@ import {
|
|
|
36
35
|
*/
|
|
37
36
|
export module Assertions {
|
|
38
37
|
|
|
38
|
+
|
|
39
|
+
|
|
39
40
|
export function assertRequestIntegrity(options: Config, elem: DQ): void | never {
|
|
40
41
|
/*assert if the onerror is set and once if it is set it must be of type function*/
|
|
41
42
|
assertFunction(options.getIf(ON_ERROR).value);
|
|
@@ -43,12 +44,12 @@ export module Assertions {
|
|
|
43
44
|
assertFunction(options.getIf(ON_EVENT).value);
|
|
44
45
|
//improve the error messages if an empty elem is passed
|
|
45
46
|
//Assertions.assertElementExists(elem);
|
|
46
|
-
assert(elem.isPresent(), getMessage("ERR_MUST_BE_PROVIDED1", "{0}: source must be provided or exist", "source element id"), "faces.ajax.request", "ArgNotSet", )
|
|
47
|
+
assert(elem.isPresent(), ExtLang.getMessage("ERR_MUST_BE_PROVIDED1", "{0}: source must be provided or exist", "source element id"), "faces.ajax.request", "ArgNotSet", )
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
export function assertUrlExists(node: XMLQuery): void | never {
|
|
50
51
|
if (node.attr(ATTR_URL).isAbsent()) {
|
|
51
|
-
throw Assertions.raiseError(new Error(), getMessage("ERR_RED_URL", null, "
|
|
52
|
+
throw Assertions.raiseError(new Error(), ExtLang.getMessage("ERR_RED_URL", null, "processRedirect"), "processRedirect");
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
|
|
@@ -59,7 +60,7 @@ export module Assertions {
|
|
|
59
60
|
export function assertValidXMLResponse(responseXML: XMLQuery) : void | never {
|
|
60
61
|
assert(!responseXML.isAbsent(), EMPTY_RESPONSE, PHASE_PROCESS_RESPONSE);
|
|
61
62
|
assert(!responseXML.isXMLParserError(), responseXML.parserErrorText(EMPTY_STR), PHASE_PROCESS_RESPONSE);
|
|
62
|
-
assert(responseXML.querySelectorAll(
|
|
63
|
+
assert(responseXML.querySelectorAll(XML_TAG_PARTIAL_RESP).isPresent(), ERR_NO_PARTIAL_RESPONSE, PHASE_PROCESS_RESPONSE);
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
/**
|
|
@@ -79,7 +80,7 @@ export module Assertions {
|
|
|
79
80
|
let finalMessage = message ?? EMPTY_STR;
|
|
80
81
|
|
|
81
82
|
//TODO clean up the messy makeException, this is a perfect case for encapsulation and sane defaults
|
|
82
|
-
return makeException(error, finalTitle, finalName, "Response", caller || (((<any>arguments).caller) ? (<any>arguments).caller.toString() : "_raiseError"), finalMessage);
|
|
83
|
+
return ExtLang.makeException(error, finalTitle, finalName, "Response", caller || (((<any>arguments).caller) ? (<any>arguments).caller.toString() : "_raiseError"), finalMessage);
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
/*
|
|
@@ -103,6 +104,13 @@ export module Assertions {
|
|
|
103
104
|
export function assertFunction(value: any, msg = EMPTY_STR, caller=EMPTY_STR, title="Assertion Error"): asserts value is Function {
|
|
104
105
|
assertType(value, "function", msg, caller, title);
|
|
105
106
|
}
|
|
107
|
+
|
|
108
|
+
export function assertDelay(value: any) {
|
|
109
|
+
if(!(value >= 0)) { // >= 0 abbreviation which covers all cases of non positive values,
|
|
110
|
+
// including NaN and non numeric strings, no type equality is deliberate here,
|
|
111
|
+
throw new Error("Invalid delay value: " + value);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
106
114
|
}
|
|
107
115
|
|
|
108
116
|
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* Asynchronous queue member for our asynchronous queue
|
|
19
19
|
* Ever object in the asynchronous queue needs to implement this interface
|
|
20
20
|
*
|
|
21
|
-
* the usage should be similar as
|
|
21
|
+
* the usage should be similar as Promise. from the outside.
|
|
22
22
|
* but with a dedicated start point. The problem why we cannot use
|
|
23
23
|
* promises here, is mostly related to the needed cancel functionality
|
|
24
24
|
* and that the queue expects a runnable as entry.
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* from the implementation side it is mostly registering callbacks
|
|
27
27
|
* and calling them at the appropriate time.
|
|
28
28
|
*/
|
|
29
|
-
export interface
|
|
29
|
+
export interface IAsyncRunnable<T> {
|
|
30
30
|
/**
|
|
31
31
|
* starts the runnable
|
|
32
32
|
*/
|
|
@@ -42,24 +42,24 @@ export interface AsyncRunnable<T> {
|
|
|
42
42
|
* triggered when the async run is complete
|
|
43
43
|
*
|
|
44
44
|
* the async runnable must register the passed function
|
|
45
|
-
* and then triggers all the registered
|
|
45
|
+
* and then triggers all the registered then functions
|
|
46
46
|
* when it is complete
|
|
47
47
|
*
|
|
48
|
-
* @param func
|
|
48
|
+
* @param func the then functor
|
|
49
49
|
*/
|
|
50
|
-
then(func: (data: any) => any):
|
|
50
|
+
then(func: (data: any) => any): IAsyncRunnable<T>;
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* callback for catch functionality
|
|
54
|
-
* triggered when the
|
|
54
|
+
* triggered when the async run is complete
|
|
55
55
|
*
|
|
56
56
|
* the async runnable must register the passed function
|
|
57
|
-
* and then triggers all the registered
|
|
57
|
+
* and then triggers all the registered catch handlers
|
|
58
58
|
* when an error has occurred
|
|
59
59
|
*
|
|
60
60
|
* @param func
|
|
61
61
|
*/
|
|
62
|
-
catch(func: (data: any) => any):
|
|
62
|
+
catch(func: (data: any) => any): IAsyncRunnable<T>;
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
/**
|
|
@@ -68,5 +68,80 @@ export interface AsyncRunnable<T> {
|
|
|
68
68
|
* and once the finally time for the promise has
|
|
69
69
|
* come the finally functions must be performed
|
|
70
70
|
*/
|
|
71
|
-
finally(func: () => void):
|
|
72
|
-
}
|
|
71
|
+
finally(func: () => void): IAsyncRunnable<T>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* pretty much the same as cancellable Promise, but given
|
|
77
|
+
* we do not have that on browser level yet this is sort
|
|
78
|
+
* of a non - intrusive Shim!
|
|
79
|
+
*/
|
|
80
|
+
export abstract class AsyncRunnable<T> implements IAsyncRunnable<T>{
|
|
81
|
+
/**
|
|
82
|
+
* helper support so that we do not have to drag in Promise shims
|
|
83
|
+
*/
|
|
84
|
+
private catchFunctions: Array<Function> = [];
|
|
85
|
+
private thenFunctions: Array<Function> = [];
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* cancel the run of the runnable (which then depending on the implementation
|
|
89
|
+
* either triggers indirectly resolve or reject)
|
|
90
|
+
*/
|
|
91
|
+
abstract cancel(): void;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* extended functionality start to trigger the runnable
|
|
95
|
+
*/
|
|
96
|
+
abstract start(): void;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* resolve handler function which calls the then chain
|
|
100
|
+
* and after that finally
|
|
101
|
+
* @param data
|
|
102
|
+
*/
|
|
103
|
+
resolve(data: any) {
|
|
104
|
+
this.thenFunctions.reduce((inputVal: any, thenFunc: any) => {
|
|
105
|
+
return thenFunc(inputVal);
|
|
106
|
+
}, data)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* reject handler function which triggers the catch chain
|
|
111
|
+
* @param data
|
|
112
|
+
*/
|
|
113
|
+
reject(data: any) {
|
|
114
|
+
this.catchFunctions.reduce((inputVal: any, catchFunc: any) => {
|
|
115
|
+
return catchFunc(inputVal);
|
|
116
|
+
}, data);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* register a catch functor
|
|
121
|
+
* @param func the functor for the catch monad
|
|
122
|
+
*/
|
|
123
|
+
catch(func: (data: any) => any): IAsyncRunnable<T> {
|
|
124
|
+
this.catchFunctions.push(func);
|
|
125
|
+
return this;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* registers a finally functor
|
|
130
|
+
* @param func the functor for the finally handling chanin
|
|
131
|
+
*/
|
|
132
|
+
finally(func: () => void): IAsyncRunnable<T> {
|
|
133
|
+
// no ie11 support we probably are going to revert to shims for that one
|
|
134
|
+
this.catchFunctions.push(func);
|
|
135
|
+
this.thenFunctions.push(func);
|
|
136
|
+
return this;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* @param func then functor similar to promise
|
|
141
|
+
*/
|
|
142
|
+
then(func: (data: any) => any): IAsyncRunnable<T> {
|
|
143
|
+
this.thenFunctions.push(func);
|
|
144
|
+
return this;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|