simple refactoring
issue: TOBAGO-1633: TS refactoring
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-jsf.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-jsf.ts
index 34f2588..75ca34d 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-jsf.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-jsf.ts
@@ -19,7 +19,7 @@
import {ReloadManager} from "./tobago-reload";
import {Overlay} from "./tobago-overlay";
-export enum JsfParameter {
+enum JsfParameter {
VIEW_STATE = "javax.faces.ViewState",
CLIENT_WINDOW = "javax.faces.ClientWindow",
VIEW_ROOT = "javax.faces.ViewRoot",
@@ -28,7 +28,7 @@
RESOURCE = "javax.faces.Resource"
}
-class Jsf {
+export class Jsf {
private static isId = function (id: string): boolean {
switch (id) {
@@ -54,7 +54,7 @@
}
};
- static init = function (): void {
+ static registerAjaxListener = function (): void {
jsf.ajax.addOnEvent(function (event): void {
console.timeEnd("[tobago-jsf] jsf-ajax");
console.time("[tobago-jsf] jsf-ajax");
@@ -91,5 +91,3 @@
});
};
}
-
-Listener.register(Jsf.init, Phase.DOCUMENT_READY);
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-page.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-page.ts
index 038e935..931fe6b 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-page.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-page.ts
@@ -16,6 +16,7 @@
*/
import {DomUtils} from "./tobago-utils";
+import {Jsf} from "./tobago-jsf";
export class Page extends HTMLElement {
@@ -39,6 +40,9 @@
}
connectedCallback(): void {
+
+ Jsf.registerAjaxListener();
+
this.addEventListener("keypress", function (event: KeyboardEvent): boolean {
let code = event.which; // XXX deprecated
if (code === 0) {