You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2021/06/03 21:43:55 UTC
[myfaces-tobago] branch master updated: refactor: clean up
This is an automated email from the ASF dual-hosted git repository.
lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
The following commit(s) were added to refs/heads/master by this push:
new 1d3fd83 refactor: clean up
1d3fd83 is described below
commit 1d3fd83e56cc3046201f155098e5d88ff643b215
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Thu Jun 3 18:05:05 2021 +0200
refactor: clean up
listeners no longer needed
issues: TOBAGO-1633
---
.../50-migration/95-migration/4.0_to_5.0.xhtml | 6 +-
.../tobago-theme-standard/src/main/js/tobago.js | 175 ---------------------
.../src/main/js/tobago.js.map | 2 +-
.../src/main/js/tobago.min.js | 4 +-
.../src/main/js/tobago.min.js.map | 2 +-
.../src/main/ts/tobago-all.ts | 1 -
.../src/main/ts/tobago-command.ts | 23 +--
.../src/main/ts/tobago-listener.ts | 150 ------------------
.../src/main/ts/tobago-page.ts | 22 ---
9 files changed, 6 insertions(+), 379 deletions(-)
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/50-migration/95-migration/4.0_to_5.0.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/50-migration/95-migration/4.0_to_5.0.xhtml
index 14d1d5e..29b34cc 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/50-migration/95-migration/4.0_to_5.0.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/50-migration/95-migration/4.0_to_5.0.xhtml
@@ -78,16 +78,12 @@
<tc:section id="javascript-api" label="JavaScript API">
- <tc:section id="listener" label="Listener Registration (work in progress)">
+ <tc:section id="listener" label="Listener Registration Removed">
<demo-highlight language="java">Tobago.registerListener(Demo.init, Tobago.Phase.DOCUMENT_READY);
Tobago.registerListener(Demo.init, Tobago.Phase.AFTER_UPDATE);
</demo-highlight>
- <demo-highlight language="java">Listener.register(Demo.init, Phase.DOCUMENT_READY);
-Listener.register(Demo.init, Phase.AFTER_UPDATE);
-</demo-highlight>
-
</tc:section>
</tc:section>
diff --git a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
index c565efb..1d727e9 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
+++ b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
@@ -19,138 +19,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- var Phase;
- (function (Phase) {
- /** after the DOM was build */
- Phase[Phase["DOCUMENT_READY"] = 0] = "DOCUMENT_READY";
- /** after all images and CSS was loaded */
- Phase[Phase["WINDOW_LOAD"] = 1] = "WINDOW_LOAD";
- /** before sending a normal submit action */
- Phase[Phase["BEFORE_SUBMIT"] = 2] = "BEFORE_SUBMIT";
- /** after an AJAX call */
- Phase[Phase["AFTER_UPDATE"] = 3] = "AFTER_UPDATE";
- /** before ending a page */
- Phase[Phase["BEFORE_UNLOAD"] = 4] = "BEFORE_UNLOAD";
- /** before closing a window or tab */
- Phase[Phase["BEFORE_EXIT"] = 5] = "BEFORE_EXIT";
- })(Phase || (Phase = {}));
- var Order;
- (function (Order) {
- Order[Order["EARLIER"] = 0] = "EARLIER";
- Order[Order["EARLY"] = 1] = "EARLY";
- Order[Order["NORMAL"] = 2] = "NORMAL";
- Order[Order["LATE"] = 3] = "LATE";
- Order[Order["LATER"] = 4] = "LATER";
- })(Order || (Order = {}));
- class ListenerList {
- constructor() {
- this.map = new Map([
- [Order.EARLIER, []],
- [Order.EARLY, []],
- [Order.NORMAL, []],
- [Order.LATE, []],
- [Order.LATER, []]
- ]);
- }
- add(listener, order) {
- this.map.get(order).push(listener);
- }
- execute(element) {
- this.map.forEach((listeners, order) => {
- listeners.forEach((listener, index) => {
- console.time("[tobago] execute " + order + " " + index);
- listener(element);
- console.timeEnd("[tobago] execute " + order + " " + index);
- });
- });
- }
- }
- class Listener {
- /**
- * Register a function to be executed on certain events.
- * @param listener Function to be executed.
- * @param phase The phase when code should be executed (e. g. Phase.DOCUMENT_READY).
- * @param order An optional order to sort function they depend on others (default: Tobago.Order.NORMAL).
- */
- static register(listener, phase, order = Order.NORMAL) {
- switch (phase) {
- case Phase.DOCUMENT_READY:
- Listener.documentReady.add(listener, order);
- break;
- case Phase.WINDOW_LOAD:
- Listener.windowLoad.add(listener, order);
- break;
- case Phase.BEFORE_SUBMIT:
- Listener.beforeSubmit.add(listener, order);
- break;
- case Phase.AFTER_UPDATE:
- Listener.afterUpdate.add(listener, order);
- break;
- case Phase.BEFORE_UNLOAD:
- Listener.beforeUnload.add(listener, order);
- break;
- case Phase.BEFORE_EXIT:
- Listener.beforeExit.add(listener, order);
- break;
- default:
- console.error("Unknown phase: '" + phase + "'");
- }
- }
- static executeDocumentReady(element) {
- console.time("[tobago] execute documentReady");
- Listener.documentReady.execute(element);
- console.timeEnd("[tobago] execute documentReady");
- }
- static executeWindowLoad() {
- console.time("[tobago] execute windowLoad");
- Listener.windowLoad.execute();
- console.timeEnd("[tobago] execute windowLoad");
- }
- static executeBeforeSubmit() {
- console.time("[tobago] execute beforeSubmit");
- Listener.beforeSubmit.execute();
- console.timeEnd("[tobago] execute beforeSubmit");
- }
- static executeAfterUpdate(element) {
- console.time("[tobago] execute afterUpdate");
- Listener.afterUpdate.execute(element);
- console.timeEnd("[tobago] execute afterUpdate");
- }
- static executeBeforeUnload() {
- console.time("[tobago] execute beforeUnload");
- Listener.beforeUnload.execute();
- console.timeEnd("[tobago] execute beforeUnload");
- }
- static executeBeforeExit() {
- console.time("[tobago] execute beforeExit");
- Listener.beforeExit.execute();
- console.timeEnd("[tobago] execute beforeExit");
- }
- }
- // XXX check if "static" is nice
- Listener.documentReady = new ListenerList();
- Listener.windowLoad = new ListenerList();
- Listener.beforeSubmit = new ListenerList();
- Listener.afterUpdate = new ListenerList();
- Listener.beforeUnload = new ListenerList();
- Listener.beforeExit = new ListenerList();
-
- /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
// XXX remove me, for cleanup
class DomUtils {
/**
@@ -10080,27 +9948,6 @@
}, true);
};
CommandHelper.onSubmit = function (listenerOptions) {
- Listener.executeBeforeSubmit();
- /*
- XXX check if we need the return false case
- XXX maybe we cancel the submit, but we continue the rest?
- XXX should the other phases also have this feature?
-
- var result = true; // Do not continue if any function returns false
- for (var order = 0; order < Listeners.beforeSubmit.length; order++) {
- var list = Listeners.beforeSubmit[order];
- for (var i = 0; i < list.length; i++) {
- result = list[i](listenerOptions);
- if (result === false) {
- break;
- }
- }
- }
- if (result === false) {
- this.isSubmit = false;
- return false;
- }
- */
CommandHelper.isSubmit = true;
const element = document.documentElement; // XXX this might be the wrong element in case of shadow dom
Page.page(element).onBeforeUnload();
@@ -10257,8 +10104,6 @@
return false;
}
});
- // todo remove this
- Listener.executeDocumentReady(document.documentElement);
}
onBeforeUnload() {
if (this.transition) {
@@ -10277,9 +10122,6 @@
}
this.transition = this.oldTransition;
}
- else {
- Listener.executeBeforeExit();
- }
}
registerAjaxListener() {
jsf.ajax.addOnEvent(this.jsfResponse.bind(this));
@@ -10303,21 +10145,6 @@
rootNode = document;
}
console.info("[tobago-jsf] Update after jsf.ajax success: %s", id);
- if (JsfParameter.isJsfId(id)) {
- console.debug("[tobago-jsf] updating #%s", id);
- const element = rootNode.getElementById(id);
- if (element) {
- Listener.executeAfterUpdate(element);
- }
- else {
- console.warn("[tobago-jsf] element not found for #%s", id);
- }
- }
- else if (JsfParameter.isJsfBody(id)) {
- console.debug("[tobago-jsf] updating body");
- // there should be only one element with this tag name
- Listener.executeAfterUpdate(rootNode.querySelector("tobago-page"));
- }
}
jsfResponseComplete(update) {
const id = update.id;
@@ -10339,8 +10166,6 @@
window.customElements.define("tobago-page", Page);
}
});
- // todo remove this
- window.addEventListener("load", Listener.executeWindowLoad);
class JsfParameter {
static isJsfId(id) {
switch (id) {
diff --git a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map
index 616410e..65bcea0 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map
+++ b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map
@@ -1 +1 @@
-{"version":3,"file":"tobago.js","sources":["../ts/tobago-listener.ts","../ts/tobago-utils.ts","../ts/tobago-bar.ts","../ts/tobago-behavior-mode.ts","../ts/tobago-collapsible-operation.ts","../ts/tobago-dropdown.ts","../../../../node_modules/vanillajs-datepicker/js/lib/utils.js","../../../../node_modules/vanillajs-datepicker/js/lib/date.js","../../../../node_modules/vanillajs-datepicker/js/lib/date-format.js","../../../../node_modules/vanillajs-datepicker/js/lib/event.js","../../../../nod [...]
\ No newline at end of file
+{"version":3,"file":"tobago.js","sources":["../ts/tobago-utils.ts","../ts/tobago-bar.ts","../ts/tobago-behavior-mode.ts","../ts/tobago-collapsible-operation.ts","../ts/tobago-dropdown.ts","../../../../node_modules/vanillajs-datepicker/js/lib/utils.js","../../../../node_modules/vanillajs-datepicker/js/lib/date.js","../../../../node_modules/vanillajs-datepicker/js/lib/date-format.js","../../../../node_modules/vanillajs-datepicker/js/lib/event.js","../../../../node_modules/vanillajs-datepic [...]
\ No newline at end of file
diff --git a/tobago-theme/tobago-theme-standard/src/main/js/tobago.min.js b/tobago-theme/tobago-theme-standard/src/main/js/tobago.min.js
index d11c00f..029af1f 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/tobago.min.js
+++ b/tobago-theme/tobago-theme-standard/src/main/js/tobago.min.js
@@ -1,8 +1,8 @@
-!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";var e,t,s,i;!function(e){e[e.DOCUMENT_READY=0]="DOCUMENT_READY",e[e.WINDOW_LOAD=1]="WINDOW_LOAD",e[e.BEFORE_SUBMIT=2]="BEFORE_SUBMIT",e[e.AFTER_UPDATE=3]="AFTER_UPDATE",e[e.BEFORE_UNLOAD=4]="BEFORE_UNLOAD",e[e.BEFORE_EXIT=5]="BEFORE_EXIT"}(e||(e={})),function(e){e[e.EARLIER=0]="EARLIER",e[e.EARLY=1]="EARLY",e[e.NORMAL=2]="NORMAL",e[e.LATE=3]="LATE",e[e.LATER=4]="LATER"}(t||(t={}));class n{construct [...]
+!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";class e{static selfOrQuerySelectorAll(e,t){const s=new Array;e||(e=document.documentElement),e.matches(t)&&s.push(e);for(const i of e.querySelectorAll(t))s.push(i);return s}static getTransitionTime(e){const t=window.getComputedStyle(e);return 1e3*(Number.parseFloat(t.transitionDelay)+Number.parseFloat(t.transitionDuration))}}class t extends HTMLElement{constructor(){super(),this.CssClass={SHOW:"sho [...]
/*!
* Bootstrap v5.0.1 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
-const Ls={find:(e,t=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(t,e)),findOne:(e,t=document.documentElement)=>Element.prototype.querySelector.call(t,e),children:(e,t)=>[].concat(...e.children).filter((e=>e.matches(t))),parents(e,t){const s=[];let i=e.parentNode;for(;i&&i.nodeType===Node.ELEMENT_NODE&&3!==i.nodeType;)i.matches(t)&&s.push(i),i=i.parentNode;return s},prev(e,t){let s=e.previousElementSibling;for(;s;){if(s.matches(t))return[s];s=s.previousE [...]
+const ws={find:(e,t=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(t,e)),findOne:(e,t=document.documentElement)=>Element.prototype.querySelector.call(t,e),children:(e,t)=>[].concat(...e.children).filter((e=>e.matches(t))),parents(e,t){const s=[];let i=e.parentNode;for(;i&&i.nodeType===Node.ELEMENT_NODE&&3!==i.nodeType;)i.matches(t)&&s.push(i),i=i.parentNode;return s},prev(e,t){let s=e.previousElementSibling;for(;s;){if(s.matches(t))return[s];s=s.previousE [...]
//# sourceMappingURL=tobago.min.js.map
diff --git a/tobago-theme/tobago-theme-standard/src/main/js/tobago.min.js.map b/tobago-theme/tobago-theme-standard/src/main/js/tobago.min.js.map
index 8df109b..a45b570 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/tobago.min.js.map
+++ b/tobago-theme/tobago-theme-standard/src/main/js/tobago.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"tobago.min.js","sources":["../ts/tobago-listener.ts","../ts/tobago-behavior-mode.ts","../ts/tobago-collapsible-operation.ts","../ts/tobago-utils.ts","../ts/tobago-bar.ts","../ts/tobago-dropdown.ts","../../../../node_modules/vanillajs-datepicker/js/lib/utils.js","../../../../node_modules/vanillajs-datepicker/js/lib/date.js","../../../../node_modules/vanillajs-datepicker/js/lib/date-format.js","../../../../node_modules/vanillajs-datepicker/js/lib/event.js","../../../.. [...]
\ No newline at end of file
+{"version":3,"file":"tobago.min.js","sources":["../ts/tobago-utils.ts","../ts/tobago-bar.ts","../ts/tobago-behavior-mode.ts","../ts/tobago-collapsible-operation.ts","../ts/tobago-dropdown.ts","../../../../node_modules/vanillajs-datepicker/js/lib/utils.js","../../../../node_modules/vanillajs-datepicker/js/lib/date.js","../../../../node_modules/vanillajs-datepicker/js/lib/date-format.js","../../../../node_modules/vanillajs-datepicker/js/lib/event.js","../../../../node_modules/vanillajs-dat [...]
\ No newline at end of file
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-all.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-all.ts
index af29364..4115cec 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-all.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-all.ts
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-import "./tobago-listener";
import "./tobago-bar";
import "./tobago-behavior-mode";
import "./tobago-collapsible-operation";
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-command.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-command.ts
index 3a9a334..6acc6ab 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-command.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-command.ts
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-import {Listener} from "./tobago-listener";
import {Overlay} from "./tobago-overlay";
import {Collapse} from "./tobago-popup";
import {Page} from "./tobago-page";
@@ -302,27 +301,7 @@ export class CommandHelper {
};
static onSubmit = function (listenerOptions: any): boolean {
- Listener.executeBeforeSubmit();
- /*
- XXX check if we need the return false case
- XXX maybe we cancel the submit, but we continue the rest?
- XXX should the other phases also have this feature?
-
- var result = true; // Do not continue if any function returns false
- for (var order = 0; order < Listeners.beforeSubmit.length; order++) {
- var list = Listeners.beforeSubmit[order];
- for (var i = 0; i < list.length; i++) {
- result = list[i](listenerOptions);
- if (result === false) {
- break;
- }
- }
- }
- if (result === false) {
- this.isSubmit = false;
- return false;
- }
- */
+
CommandHelper.isSubmit = true;
const element: HTMLElement = document.documentElement; // XXX this might be the wrong element in case of shadow dom
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-listener.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-listener.ts
deleted file mode 100644
index 37f48c5..0000000
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-listener.ts
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export enum Phase {
- /** after the DOM was build */
- DOCUMENT_READY,
- /** after all images and CSS was loaded */
- WINDOW_LOAD,
- /** before sending a normal submit action */
- BEFORE_SUBMIT,
- /** after an AJAX call */
- AFTER_UPDATE,
- /** before ending a page */
- BEFORE_UNLOAD,
- /** before closing a window or tab */
- BEFORE_EXIT,
-}
-
-export enum Order {
- EARLIER = 0,
- EARLY = 1,
- NORMAL = 2,
- LATE = 3,
- LATER = 4
-}
-
-class ListenerList {
-
- map: Map<Order, Array<(HTMLElement) => void>> = new Map([
- [Order.EARLIER, []],
- [Order.EARLY, []],
- [Order.NORMAL, []],
- [Order.LATE, []],
- [Order.LATER, []]
- ]);
-
- add(listener: (HTMLElement) => void, order: Order): void {
- this.map.get(order).push(listener);
- }
-
- execute(element?: HTMLElement): void {
-
- this.map.forEach((listeners: Array<(HTMLElement) => void>, order: Order) => {
- listeners.forEach(
- (listener, index) => {
- console.time("[tobago] execute " + order + " " + index);
- listener(element);
- console.timeEnd("[tobago] execute " + order + " " + index);
- }
- );
- });
- }
-}
-
-export class Listener {
-
- // XXX check if "static" is nice
-
- static documentReady: ListenerList = new ListenerList();
- static windowLoad: ListenerList = new ListenerList();
- static beforeSubmit: ListenerList = new ListenerList();
- static afterUpdate: ListenerList = new ListenerList();
- static beforeUnload: ListenerList = new ListenerList();
- static beforeExit: ListenerList = new ListenerList();
-
- /**
- * Register a function to be executed on certain events.
- * @param listener Function to be executed.
- * @param phase The phase when code should be executed (e. g. Phase.DOCUMENT_READY).
- * @param order An optional order to sort function they depend on others (default: Tobago.Order.NORMAL).
- */
- static register(
- listener: (HTMLElement) => void,
- phase: Phase,
- order: Order = Order.NORMAL): void {
-
- switch (phase) {
- case Phase.DOCUMENT_READY:
- Listener.documentReady.add(listener, order);
- break;
- case Phase.WINDOW_LOAD:
- Listener.windowLoad.add(listener, order);
- break;
- case Phase.BEFORE_SUBMIT:
- Listener.beforeSubmit.add(listener, order);
- break;
- case Phase.AFTER_UPDATE:
- Listener.afterUpdate.add(listener, order);
- break;
- case Phase.BEFORE_UNLOAD:
- Listener.beforeUnload.add(listener, order);
- break;
- case Phase.BEFORE_EXIT:
- Listener.beforeExit.add(listener, order);
- break;
- default:
- console.error("Unknown phase: '" + phase + "'");
- }
- }
-
- static executeDocumentReady(element: HTMLElement): void {
- console.time("[tobago] execute documentReady");
- Listener.documentReady.execute(element);
- console.timeEnd("[tobago] execute documentReady");
- }
-
- static executeWindowLoad(): void {
- console.time("[tobago] execute windowLoad");
- Listener.windowLoad.execute();
- console.timeEnd("[tobago] execute windowLoad");
- }
-
- static executeBeforeSubmit(): void {
- console.time("[tobago] execute beforeSubmit");
- Listener.beforeSubmit.execute();
- console.timeEnd("[tobago] execute beforeSubmit");
- }
-
- static executeAfterUpdate(element: HTMLElement): void {
- console.time("[tobago] execute afterUpdate");
- Listener.afterUpdate.execute(element);
- console.timeEnd("[tobago] execute afterUpdate");
- }
-
- static executeBeforeUnload(): void {
- console.time("[tobago] execute beforeUnload");
- Listener.beforeUnload.execute();
- console.timeEnd("[tobago] execute beforeUnload");
- }
-
- static executeBeforeExit(): void {
- console.time("[tobago] execute beforeExit");
- Listener.beforeExit.execute();
- console.timeEnd("[tobago] execute beforeExit");
- }
-}
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-page.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-page.ts
index 91c249a..48fa6de 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-page.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-page.ts
@@ -17,7 +17,6 @@
import {CommandHelper} from "./tobago-command";
import {Overlay} from "./tobago-overlay";
-import {Listener} from "./tobago-listener";
export class Page extends HTMLElement {
@@ -111,9 +110,6 @@ export class Page extends HTMLElement {
return false;
}
});
-
- // todo remove this
- Listener.executeDocumentReady(document.documentElement);
}
onBeforeUnload(): void {
@@ -133,8 +129,6 @@ export class Page extends HTMLElement {
new Overlay(this);
}
this.transition = this.oldTransition;
- } else {
- Listener.executeBeforeExit();
}
}
@@ -161,19 +155,6 @@ export class Page extends HTMLElement {
rootNode = document;
}
console.info("[tobago-jsf] Update after jsf.ajax success: %s", id);
- if (JsfParameter.isJsfId(id)) {
- console.debug("[tobago-jsf] updating #%s", id);
- const element = rootNode.getElementById(id);
- if (element) {
- Listener.executeAfterUpdate(element);
- } else {
- console.warn("[tobago-jsf] element not found for #%s", id);
- }
- } else if (JsfParameter.isJsfBody(id)) {
- console.debug("[tobago-jsf] updating body");
- // there should be only one element with this tag name
- Listener.executeAfterUpdate(rootNode.querySelector("tobago-page") as HTMLElement);
- }
}
jsfResponseComplete(update: Element): void {
@@ -199,9 +180,6 @@ document.addEventListener("tobago.init", (event: Event): void => {
}
});
-// todo remove this
-window.addEventListener("load", Listener.executeWindowLoad);
-
class JsfParameter {
static VIEW_STATE = "javax.faces.ViewState";