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.
Files changed (214) hide show
  1. package/.nyc_output/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
  2. package/.nyc_output/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
  3. package/.nyc_output/processinfo/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
  4. package/.nyc_output/processinfo/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
  5. package/.nyc_output/processinfo/index.json +1 -1
  6. package/README.md +13 -21
  7. package/dist/docs/assets/main.js +56 -52
  8. package/dist/docs/assets/search.js +1 -1
  9. package/dist/docs/assets/style.css +23 -0
  10. package/dist/docs/functions/faces.ajax.addOnError.html +2 -0
  11. package/dist/docs/functions/faces.ajax.addOnEvent.html +2 -0
  12. package/dist/docs/functions/faces.push.close.html +4 -2
  13. package/dist/docs/functions/faces.push.init.html +19 -7
  14. package/dist/docs/functions/faces.push.open.html +4 -2
  15. package/dist/docs/functions/myfaces.ab.html +9 -4
  16. package/dist/docs/functions/myfaces.onDomReady.html +72 -0
  17. package/dist/docs/index.html +16 -18
  18. package/dist/docs/modules/myfaces.html +3 -1
  19. package/dist/docs/variables/myfaces.oam.html +2 -1
  20. package/dist/window/faces-development.js +2846 -2085
  21. package/dist/window/faces-development.js.br +0 -0
  22. package/dist/window/faces-development.js.gz +0 -0
  23. package/dist/window/faces-development.js.map +1 -1
  24. package/dist/window/faces.js +1 -1
  25. package/dist/window/faces.js.LICENSE.txt +17 -2
  26. package/dist/window/faces.js.br +0 -0
  27. package/dist/window/faces.js.gz +0 -0
  28. package/dist/window/faces.js.map +1 -1
  29. package/dist/window/jsf-development.js +2856 -2084
  30. package/dist/window/jsf-development.js.br +0 -0
  31. package/dist/window/jsf-development.js.gz +0 -0
  32. package/dist/window/jsf-development.js.map +1 -1
  33. package/dist/window/jsf.js +1 -1
  34. package/dist/window/jsf.js.LICENSE.txt +17 -2
  35. package/dist/window/jsf.js.br +0 -0
  36. package/dist/window/jsf.js.gz +0 -0
  37. package/dist/window/jsf.js.map +1 -1
  38. package/package.json +19 -18
  39. package/plans for 4.0.1.txt +8 -0
  40. package/src/main/test.xml +23 -0
  41. package/src/main/typescript/@types/definitions/index.d.ts +19 -2
  42. package/src/main/typescript/api/_api.ts +68 -25
  43. package/src/main/typescript/api/jsf.ts +18 -0
  44. package/src/main/typescript/impl/AjaxImpl.ts +204 -100
  45. package/src/main/typescript/impl/PushImpl.ts +63 -38
  46. package/src/main/typescript/impl/core/Const.ts +56 -40
  47. package/src/main/typescript/impl/util/Assertions.ts +16 -8
  48. package/src/main/typescript/impl/util/AsyncRunnable.ts +85 -10
  49. package/src/main/typescript/impl/util/ExtDomQuery.ts +65 -54
  50. package/src/main/typescript/impl/util/FileUtils.ts +108 -0
  51. package/src/main/typescript/impl/util/HiddenInputBuilder.ts +93 -0
  52. package/src/main/typescript/impl/util/Lang.ts +91 -35
  53. package/src/main/typescript/impl/util/XhrQueueController.ts +112 -0
  54. package/src/main/typescript/impl/xhrCore/ErrorData.ts +15 -10
  55. package/src/main/typescript/impl/xhrCore/EventData.ts +3 -3
  56. package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +25 -11
  57. package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +78 -32
  58. package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +10 -10
  59. package/src/main/typescript/impl/xhrCore/Response.ts +66 -49
  60. package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +211 -138
  61. package/src/main/typescript/impl/xhrCore/XhrFormData.ts +92 -166
  62. package/src/main/typescript/impl/xhrCore/XhrRequest.ts +111 -120
  63. package/src/main/typescript/myfaces/OamSubmit.ts +30 -14
  64. package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +163 -27
  65. package/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.ts +4 -4
  66. package/src/main/typescript/test/frameworkBase/_ext/monadish/fixtures/blank.css +0 -0
  67. package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.ts +921 -0
  68. package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.ts +108 -0
  69. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +111 -3
  70. package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +40 -1
  71. package/src/main/typescript/test/frameworkBase/_ext/shared/fixtures/jakarta.faces.resource/faces.js.jsf +0 -0
  72. package/src/main/typescript/test/impl/ImplTest.spec.ts +3 -3
  73. package/src/main/typescript/test/impl/ImplTest_23.spec.ts +3 -7
  74. package/src/main/typescript/test/myfaces/OnLoadSpec.ts +52 -0
  75. package/src/main/typescript/test/queue/AsynchronousProbe.ts +5 -5
  76. package/src/main/typescript/test/queue/AsynchronousQueueTest.spec.ts +4 -3
  77. package/src/main/typescript/test/xhrCore/EventTests.spec.ts +28 -22
  78. package/src/main/typescript/test/xhrCore/FileUploadTest.spec.ts +5 -2
  79. package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +203 -0
  80. package/src/main/typescript/test/xhrCore/OamSubmitTest.spec.ts +177 -0
  81. package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +158 -17
  82. package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +320 -15
  83. package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +45 -4
  84. package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +374 -35
  85. package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +43 -9
  86. package/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.ts +109 -0
  87. package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +67 -49
  88. package/src/main/typescript/test.xml +6 -0
  89. package/src/main/typescript/tsconfig.json +1 -1
  90. package/src/test/resources/jsf-development.js +1 -1
  91. package/src/tmp/test.html +12 -88
  92. package/target/api/_api.js +63 -21
  93. package/target/api/_api.js.map +1 -1
  94. package/target/api/jsf.js +11 -0
  95. package/target/api/jsf.js.map +1 -1
  96. package/target/classes/com/example/jsfs_js_ts/DecoratedFacesJS.class +0 -0
  97. package/target/classes/com/example/jsfs_js_ts/DecoratingResourceHandlerWrapper.class +0 -0
  98. package/target/classes/com/example/jsfs_js_ts/FacesJSMapFileResourceWrapper.class +0 -0
  99. package/target/classes/com/example/jsfs_js_ts/FacesJSMappingDecorator.class +0 -0
  100. package/target/impl/AjaxImpl.js +177 -81
  101. package/target/impl/AjaxImpl.js.map +1 -1
  102. package/target/impl/PushImpl.js +66 -35
  103. package/target/impl/PushImpl.js.map +1 -1
  104. package/target/impl/core/Const.js +54 -39
  105. package/target/impl/core/Const.js.map +1 -1
  106. package/target/impl/core/Context.js +10 -0
  107. package/target/impl/core/Context.js.map +1 -0
  108. package/target/impl/util/Assertions.js +12 -7
  109. package/target/impl/util/Assertions.js.map +1 -1
  110. package/target/impl/util/AsyncQueue.js.map +1 -1
  111. package/target/impl/util/AsyncRunnable.js +60 -0
  112. package/target/impl/util/AsyncRunnable.js.map +1 -1
  113. package/target/impl/util/ExtDomQuery.js +66 -48
  114. package/target/impl/util/ExtDomQuery.js.map +1 -1
  115. package/target/impl/util/FileUtils.js +97 -0
  116. package/target/impl/util/FileUtils.js.map +1 -0
  117. package/target/impl/util/HiddenElementBuilder.js +7 -0
  118. package/target/impl/util/HiddenElementBuilder.js.map +1 -0
  119. package/target/impl/util/HiddenInputBuilder.js +83 -0
  120. package/target/impl/util/HiddenInputBuilder.js.map +1 -0
  121. package/target/{types/index.js → impl/util/IAsyncRunnable.js} +11 -2
  122. package/target/impl/util/IAsyncRunnable.js.map +1 -0
  123. package/target/impl/util/Lang.js +81 -31
  124. package/target/impl/util/Lang.js.map +1 -1
  125. package/target/impl/util/URLCodec.js +77 -0
  126. package/target/impl/util/URLCodec.js.map +1 -0
  127. package/target/impl/util/XhrQueueController.js +107 -0
  128. package/target/impl/util/XhrQueueController.js.map +1 -0
  129. package/target/impl/xhrCore/ErrorData.js +10 -8
  130. package/target/impl/xhrCore/ErrorData.js.map +1 -1
  131. package/target/impl/xhrCore/EventData.js +2 -2
  132. package/target/impl/xhrCore/EventData.js.map +1 -1
  133. package/target/impl/xhrCore/RequestContext.js +11 -0
  134. package/target/impl/xhrCore/RequestContext.js.map +1 -0
  135. package/target/impl/xhrCore/RequestDataResolver.js +70 -23
  136. package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
  137. package/target/impl/xhrCore/ResonseDataResolver.js +9 -9
  138. package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
  139. package/target/impl/xhrCore/Response.js +44 -29
  140. package/target/impl/xhrCore/Response.js.map +1 -1
  141. package/target/impl/xhrCore/ResponseProcessor.js +187 -119
  142. package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
  143. package/target/impl/xhrCore/XhrFormData.js +82 -156
  144. package/target/impl/xhrCore/XhrFormData.js.map +1 -1
  145. package/target/impl/xhrCore/XhrQueHandler.js +11 -0
  146. package/target/impl/xhrCore/XhrQueHandler.js.map +1 -0
  147. package/target/impl/xhrCore/XhrQueueController.js +62 -0
  148. package/target/impl/xhrCore/XhrQueueController.js.map +1 -0
  149. package/target/impl/xhrCore/XhrRequest.js +94 -106
  150. package/target/impl/xhrCore/XhrRequest.js.map +1 -1
  151. package/target/myfaces/OamSubmit.js +25 -14
  152. package/target/myfaces/OamSubmit.js.map +1 -1
  153. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +124 -23
  154. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
  155. package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js +76 -0
  156. package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js.map +1 -0
  157. package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +4 -4
  158. package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +1 -1
  159. package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js +925 -0
  160. package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js.map +1 -0
  161. package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js +112 -0
  162. package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js.map +1 -0
  163. package/target/test/frameworkBase/_ext/shared/StandardInits.js +103 -3
  164. package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
  165. package/target/test/frameworkBase/_ext/shared/XmlResponses.js +37 -1
  166. package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
  167. package/target/test/impl/ImplTest.spec.js +2 -2
  168. package/target/test/impl/ImplTest.spec.js.map +1 -1
  169. package/target/test/impl/ImplTest_23.spec.js +2 -2
  170. package/target/test/impl/ImplTest_23.spec.js.map +1 -1
  171. package/target/test/myfaces/OnLoadSpec.js +57 -0
  172. package/target/test/myfaces/OnLoadSpec.js.map +1 -0
  173. package/target/test/queue/AsynchronousQueueTest.spec.js +3 -3
  174. package/target/test/queue/AsynchronousQueueTest.spec.js.map +1 -1
  175. package/target/test/xhrCore/EventTests.spec.js +26 -19
  176. package/target/test/xhrCore/EventTests.spec.js.map +1 -1
  177. package/target/test/xhrCore/FileUploadTest.spec.js +2 -1
  178. package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
  179. package/target/test/xhrCore/NamespacesRequestTest.spec.js +204 -0
  180. package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -0
  181. package/target/test/xhrCore/OamSubmitTest.spec.js +180 -0
  182. package/target/test/xhrCore/OamSubmitTest.spec.js.map +1 -0
  183. package/target/test/xhrCore/RequestParamsTest.spec.js +142 -10
  184. package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
  185. package/target/test/xhrCore/RequestTest.spec.js +288 -11
  186. package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
  187. package/target/test/xhrCore/RequestTest_23.spec.js +40 -2
  188. package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
  189. package/target/test/xhrCore/ResponseTest.spec.js +315 -24
  190. package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
  191. package/target/test/xhrCore/ResponseTest23.spec.js +38 -8
  192. package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
  193. package/target/test/xhrCore/TobagoFileUploadTest.spec.js +128 -0
  194. package/target/test/xhrCore/TobagoFileUploadTest.spec.js.map +1 -0
  195. package/target/test/xhrCore/XhrFormDataTest.spec.js +57 -34
  196. package/target/test/xhrCore/XhrFormDataTest.spec.js.map +1 -1
  197. package/target/test-classes/.gz +0 -0
  198. package/target/test-classes/com/example/jsfs_js_ts/JsfsJsTsApplicationTests.class +0 -0
  199. package/target/test-classes/fileuploadtest.html +24 -0
  200. package/target/test-classes/jsf-development.js +3559 -0
  201. package/target/test-classes/jsf-development.js.br +0 -0
  202. package/target/test-classes/jsf-development.js.gz +0 -0
  203. package/target/test-classes/jsf-development.js.map +1 -0
  204. package/target/test-classes/jsf.js +3 -0
  205. package/target/test-classes/jsf.js.br +0 -0
  206. package/target/test-classes/jsf.js.gz +0 -0
  207. package/tmp.xml +36 -0
  208. package/.nyc_output/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
  209. package/.nyc_output/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
  210. package/.nyc_output/processinfo/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
  211. package/.nyc_output/processinfo/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
  212. package/src/main/typescript/impl/util/AsyncQueue.ts +0 -133
  213. package/src/main/typescript/test/frameworkBase/_ext/monadish/StreamTest.spec.ts +0 -231
  214. package/target/types/index.js.map +0 -1
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "jsf.js_next_gen",
3
- "version": "4.0.0-beta-23",
3
+ "version": "4.0.1-alpha.0",
4
4
  "description": "A next generation typescript reimplementation of jsf.js",
5
5
  "main": "dist/window/faces.js",
6
6
  "scripts": {
7
7
  "doc": "npx typedoc --tsconfig src/main/typescript/tsconfig-typedoc.json",
8
- "test": "env TS_NODE_PROJECT=./src/main/typescript/tsconfig.json mocha",
9
- "coverage": "env TS_NODE_PROJECT=./src/test/typescript/tsconfig.json nyc --reporter=html --reporter=text mocha",
8
+ "test": "cross-env TS_NODE_PROJECT=./src/main/typescript/tsconfig.json mocha",
9
+ "coverage": "cross-env TS_NODE_PROJECT=./src/main/typescript/tsconfig.json nyc --reporter=html --reporter=text mocha",
10
10
  "build-production": "webpack --mode production --env FILE_NAME=jsf && ts-node ./remap.ts --production",
11
11
  "build-development": "webpack --mode development --env FILE_NAME=jsf-development && ts-node ./remap.ts --development",
12
12
  "build": "npm run doc && npm run build-development && npm run build-production",
@@ -21,33 +21,34 @@
21
21
  "license": "Apache-2.0",
22
22
  "devDependencies": {
23
23
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
24
- "@types/chai": "^4.3.3",
25
- "@types/mocha": "^10.0.0",
26
- "@types/node": "^18.11.9",
24
+ "@types/chai": "^4.3.4",
25
+ "@types/mocha": "^10.0.1",
26
+ "@types/node": "^18.14.6",
27
27
  "@types/sinon": "^10.0.13",
28
28
  "babel-plugin-syntax-dynamic-import": "^6.18.0",
29
- "chai": "^4.3.6",
29
+ "chai": "^4.3.7",
30
30
  "compression-webpack-plugin": "^10.0.0",
31
+ "cross-env": "^7.0.3",
31
32
  "html-webpack-plugin": "^5.5.0",
32
33
  "http-server": "^14.1.1",
33
- "jsdom": "^20.0.2",
34
+ "jsdom": "^21.1.0",
34
35
  "jsdom-global": "^3.0.2",
35
- "mocha": "^10.1.0",
36
- "npm-check-updates": "^16.3.16",
36
+ "mocha": "^10.2.0",
37
+ "npm-check-updates": "^16.7.10",
37
38
  "nyc": "^15.1.0",
38
39
  "replace-in-file": "^6.3.5",
39
- "rxjs": "^7.5.7",
40
- "sinon": "^14.0.1",
40
+ "rxjs": "^7.8.0",
41
+ "sinon": "^15.0.1",
41
42
  "terser-webpack-plugin": "^5.3.6",
42
- "ts-loader": "^9.4.1",
43
+ "ts-loader": "^9.4.2",
43
44
  "ts-node": "^10.9.1",
44
- "typedoc": "^0.23.20",
45
- "typescript": "^4.8.4",
46
- "webpack": "^5.74.0",
47
- "webpack-cli": "^4.10.0",
45
+ "typedoc": "^0.23.26",
46
+ "typescript": "^4.9.5",
47
+ "webpack": "^5.75.0",
48
+ "webpack-cli": "^5.0.1",
48
49
  "webpack-dev-server": "^4.11.1"
49
50
  },
50
51
  "dependencies": {
51
- "mona-dish": "0.23.4"
52
+ "mona-dish": "0.25.28"
52
53
  }
53
54
  }
@@ -0,0 +1,8 @@
1
+ # Brainstorming for 4.0.1
2
+
3
+ * Eliminate Streams - done, this was the biggest one
4
+ * Reintroduce partial page submit (myfaces.pps?), while never really used - done, pps=true is reintroduced
5
+ reducing the commit load onto execute!
6
+
7
+ queue size reduction... not really needed, there never was a usecase for it
8
+
@@ -0,0 +1,23 @@
1
+ <partial-response id="viewroot_1">
2
+ <changes>
3
+ <update id="panel2"><![CDATA[
4
+ <div id="panel2">
5
+ after update
6
+ <form id="form2" name="form2" method="post" action="booga2"
7
+ ><a href="#" id="form2:link" name="form2:link"></a>
8
+ <input type="hidden" name="form2_SUBMIT" value="1"/></form>
9
+ </div>
10
+ ]]>
11
+ </update>
12
+ <update id="panel3"><![CDATA[
13
+ <div id="panel3">
14
+ after update
15
+ <form id="form3" name="form3" method="post" action="booga3"
16
+ ><a href="#" id="form3:link" name="form3:link"></a>
17
+ </form>
18
+ </div>
19
+ ]]>
20
+ </update>
21
+ <update id="j_id__v_0:jakarta.faces.ViewState:1"><![CDATA[booga_after_update]]></update>
22
+ </changes>
23
+ </partial-response>
@@ -23,9 +23,24 @@
23
23
  declare global {
24
24
 
25
25
  type Consumer<T> = (s?: T) => void;
26
+ type Tuple<V,K> = [V, K];
27
+ type Tuples<V,K> = [Tuple<V, K>];
26
28
  type AssocArr<T> = { [key: string]: T };
27
29
  type EvalFuncs = Array<Function | string>;
28
- type Options = { [key: string]: string | Function | { [key: string]: string | Function } };
30
+
31
+
32
+ type Options = {
33
+ render ?: string,
34
+ execute ?: string, //space separated list of client ids
35
+ onevent ?: Function, // event handler callback
36
+ onerror ?: Function, // error handler callback
37
+ params ?: AssocArr<any>, // passthrough params
38
+ delay ?: number, // delay in milliseconds
39
+ resetValues ?: boolean, // if set to true jakarta.faces.partial.resetValues is sent
40
+ /* @deprecated non-spec conform fallback behavior that anything can be passed and is used as passthrough */
41
+ [key: string]: any
42
+ }
43
+
29
44
  type Context = AssocArr<any>;
30
45
  type ElemDef = Element | string;
31
46
 
@@ -106,7 +121,7 @@ declare global {
106
121
  interface OAM {
107
122
  clearHiddenInput(formName: string, name: string): void;
108
123
  setHiddenInput(formName: string, name: string, value: string): void;
109
- submitForm(formName: string, linkId: string, target: string, params: { [key: string]: any }): boolean;
124
+ submitForm(formName: string, linkId?: string |null, target?: string | null, params?: AssocArr<any> |Tuples<string, any> | null): boolean;
110
125
  }
111
126
 
112
127
  interface MyFacesAPI {
@@ -119,6 +134,8 @@ declare global {
119
134
  };
120
135
  }
121
136
 
137
+
138
+
122
139
  /*
123
140
  * Global namespaces type definitions
124
141
  */
@@ -16,7 +16,7 @@
16
16
  import {Implementation} from "../impl/AjaxImpl";
17
17
  import {PushImpl} from "../impl/PushImpl";
18
18
  import {oam as _oam} from "../myfaces/OamSubmit";
19
- import {$nsp, CTX_PARAM_EXECUTE, CTX_PARAM_RENDER, P_BEHAVIOR_EVENT} from "../impl/core/Const";
19
+ import {$nsp, CTX_OPTIONS_EXECUTE, CTX_OPTIONS_PARAMS, CTX_PARAM_RENDER, P_BEHAVIOR_EVENT} from "../impl/core/Const";
20
20
  import {ErrorData} from "../impl/xhrCore/ErrorData";
21
21
  import {EventData} from "../impl/xhrCore/EventData";
22
22
 
@@ -49,14 +49,14 @@ export module faces {
49
49
 
50
50
  /**
51
51
  * SeparatorChar as defined by facesContext.getNamingContainerSeparatorChar()
52
- * @type {Char}
53
52
  */
54
- export var separatorchar = getSeparatorChar();
53
+ export var separatorchar: string = getSeparatorChar();
55
54
 
55
+ // noinspection JSUnusedGlobalSymbols
56
56
  /**
57
57
  * Context Path as defined externalContext.requestContextPath
58
58
  */
59
- export var contextpath = '#{facesContext.externalContext.requestContextPath}';
59
+ export var contextpath: string = '#{facesContext.externalContext.requestContextPath}';
60
60
  // we do not have a fallback here, for now
61
61
 
62
62
  /**
@@ -99,7 +99,7 @@ export module faces {
99
99
  return Implementation.getClientWindow(rootNode);
100
100
  }
101
101
 
102
- //private helper functions
102
+ // private helper functions
103
103
  function getSeparatorChar(): string {
104
104
  const sep = '#{facesContext.namingContainerSeparatorChar}';
105
105
  //We now enable standalone mode, the separator char was not mapped we make a fallback to 2.3 behavior
@@ -159,7 +159,7 @@ export module faces {
159
159
  * <li> eventData.responseXML: the requestInternal response xml </li>
160
160
  * </ul>
161
161
  *
162
- * @param {function} errorListener error handler must be of the format <i>function errorListener(&lt;errorData&gt;)</i>
162
+ * @param errorFunc error handler must be of the format <i>function errorListener(&lt;errorData&gt;)</i>
163
163
  */
164
164
  export function addOnError(errorFunc: (data: ErrorData) => void): void {
165
165
  Implementation.addOnError(<any>errorFunc);
@@ -169,7 +169,7 @@ export module faces {
169
169
  * Adds a global event listener to the ajax event queue. The event listener must be a function
170
170
  * of following format: <i>function eventListener(&lt;eventData&gt;)</i>
171
171
  *
172
- * @param {function} eventListener event must be of the format <i>function eventListener(&lt;eventData&gt;)</i>
172
+ * @param eventFunc event must be of the format <i>function eventListener(&lt;eventData&gt;)</i>
173
173
  */
174
174
  export function addOnEvent(eventFunc: (data: EventData) => void): void {
175
175
  Implementation.addOnEvent(<any>eventFunc);
@@ -184,7 +184,7 @@ export module faces {
184
184
  * if any of the code returns false, the execution
185
185
  * is terminated prematurely skipping the rest of the code!
186
186
  *
187
- * @param {DomNode} source, the callee object
187
+ * @param {HTMLElement | String} source, the callee object
188
188
  * @param {Event} event, the event object of the callee event triggering this function
189
189
  * @param funcs ... arbitrary array of functions or strings
190
190
  * @returns true if the chain has succeeded false otherwise
@@ -196,26 +196,32 @@ export module faces {
196
196
 
197
197
  export module push {
198
198
  /**
199
- * @param {function} onopen The function to be invoked when the web socket is opened.
200
- * @param {function} onmessage The function to be invoked when a message is received.
201
- * @param {function} onclose The function to be invoked when the web socket is closed.
202
- * @param {boolean} autoconnect Whether or not to immediately open the socket. Defaults to <code>false</code>.
199
+ * @param socketClientId the sockets client identifier
200
+ * @param url the uri to reach the socket
201
+ * @param channel the channel name/id
202
+ * @param onopen The function to be invoked when the web socket is opened.
203
+ * @param onmessage The function to be invoked when a message is received.
204
+ * @param onerror The function to be invoked when an error occurs.
205
+ * @param onclose The function to be invoked when the web socket is closed.
206
+ * @param behaviors functions which are invoked whenever a message is received
207
+ * @param autoConnect Whether or not to automatically open the socket. Defaults to <code>false</code>.
203
208
  */
204
209
  export function init(socketClientId: string,
205
- uri: string,
210
+ url: string,
206
211
  channel: string,
207
212
  onopen: Function,
208
213
  onmessage: Function,
214
+ onerror: Function,
209
215
  onclose: Function,
210
- behaviorScripts: any,
211
- autoconnect: boolean): void {
212
- PushImpl.init(socketClientId, uri, channel, onopen, onmessage, onclose, behaviorScripts, autoconnect);
216
+ behaviors: any,
217
+ autoConnect: boolean): void {
218
+ PushImpl.init(socketClientId, url, channel, onopen, onmessage, onerror, onclose, behaviors, autoConnect);
213
219
  }
214
220
 
215
221
  /**
216
222
  * Open the web socket on the given channel.
217
- * @param {string} channel The name of the web socket channel.
218
- * @throws {Error} When channel is unknown.
223
+ * @param socketClientId The name of the web socket channel.
224
+ * @throws Error is thrown, if the channel is unknown.
219
225
  */
220
226
  export function open(socketClientId: string): void {
221
227
  PushImpl.open(socketClientId);
@@ -223,8 +229,8 @@ export module faces {
223
229
 
224
230
  /**
225
231
  * Close the web socket on the given channel.
226
- * @param {string} channel The name of the web socket channel.
227
- * @throws {Error} When channel is unknown.
232
+ * @param socketClientId The id of the web socket client.
233
+ * @throws Error is thrown, if the channel is unknown.
228
234
  */
229
235
  export function close(socketClientId: string): void {
230
236
  PushImpl.close(socketClientId);
@@ -243,15 +249,16 @@ export module myfaces {
243
249
  * @param event the event
244
250
  * @param eventName event name for java.jakarta.faces.behavior.evemnt
245
251
  * @param execute execute list as passed down in faces.ajax.request
246
- * @param render
247
- * @param options
252
+ * @param render the render list as string
253
+ * @param options the options which need to be mered in
248
254
  */
249
- export function ab(source: Element, event: Event, eventName: string, execute: string, render: string, options: Context = {}): void {
255
+ export function ab(source: Element, event: Event, eventName: string, execute: string, render: string, options: Options = {}): void {
250
256
  if (eventName) {
251
- options[$nsp(P_BEHAVIOR_EVENT)] = eventName;
257
+ options[CTX_OPTIONS_PARAMS] = options?.[CTX_OPTIONS_PARAMS] ?? {};
258
+ options[CTX_OPTIONS_PARAMS][$nsp(P_BEHAVIOR_EVENT)] = eventName;
252
259
  }
253
260
  if (execute) {
254
- options[CTX_PARAM_EXECUTE] = execute;
261
+ options[CTX_OPTIONS_EXECUTE] = execute;
255
262
  }
256
263
  if (render) {
257
264
  options[CTX_PARAM_RENDER] = render;
@@ -260,6 +267,42 @@ export module myfaces {
260
267
  (window?.faces ?? window.jsf).ajax.request(source, event, options);
261
268
  }
262
269
 
270
+
271
+ const onReadyChain: Array<() => void> = [];
272
+ let readyStateListener = null;
273
+ // noinspection JSUnusedGlobalSymbols
274
+ /**
275
+ * Helper function in the myfaces namespace to handle document ready properly for the load case
276
+ * the ajax case, does not need proper treatment, since it is deferred anyway.
277
+ * Used by command script as helper function!
278
+ *
279
+ * @param executionFunc the function to be executed upon ready
280
+ */
281
+ export function onDomReady(executionFunc: () => void) {
282
+ if(document.readyState !== "complete") {
283
+ onReadyChain.push(executionFunc);
284
+ if(!readyStateListener) {
285
+ readyStateListener = () => {
286
+ window.removeEventListener("DOMContentLoaded", readyStateListener);
287
+ readyStateListener = null;
288
+ try {
289
+ onReadyChain.forEach(func => func());
290
+ } finally {
291
+ //done we clear now the ready chain
292
+ onReadyChain.length = 0;
293
+ }
294
+ };
295
+ window.addEventListener("DOMContentLoaded", readyStateListener);
296
+ }
297
+ } else {
298
+ if(readyStateListener) {
299
+ readyStateListener();
300
+ }
301
+ executionFunc();
302
+ }
303
+
304
+ }
305
+
263
306
  /**
264
307
  * legacy oam functions
265
308
  */
@@ -26,6 +26,24 @@ if(!window?.jsf) {
26
26
  (window as any)['jsf'] = window?.jsf ?? faces;
27
27
  window.jsf.specversion = 230000;
28
28
  delete window.jsf.contextpath;
29
+
30
+ let faces4Init = faces.push.init;
31
+ /*
32
+ * we shim back the breaking api change from 3.0 to 4.0
33
+ * onerror is gone
34
+ */
35
+ faces.push.init = (socketClientId: string,
36
+ url: string,
37
+ channel: string,
38
+ onopen: Function,
39
+ onmessage: Function,
40
+ // no on error api change for 4.0
41
+ //onerror: Function,
42
+ onclose: Function,
43
+ behaviors: any,
44
+ autoConnect: boolean) => {
45
+ faces4Init(socketClientId, url, channel, onopen, onmessage, null, onclose, behaviors, autoConnect);
46
+ }
29
47
  }
30
48
  if(!window?.myfaces?.ab) {
31
49
  const myfaces = require("./_api").myfaces;