In my 14.0.15, my app works fine with the following:
@JsModule("./js/addBeforeUnloadListener.js")
@JsModule("./js/logToConsole.js")
Inside the contrustror of this root element, I have:
currentUI = UI.getCurrent();
currentUI.addDetachListener(e->onDetach(e));
currentUI.getPage().executeJs("addBeforeUnloadListener($0)", this.getElement());
And then this public method calls logToConsole:
public static void logToConsole( Element element, String message ) {
element.executeJs("logToConsole($0)", message );
}
![Project Structure with javascript]
(https://i.postimg.cc/VNnY7yZh/JSProblem-Project-Structure.png)
Figure 1: Project Structure
But when I updated to 14.1.0 and 14.1.1, I get “logToConsole is not defined” and “addBeforeUnloadListener is not defined”. I switch back to 14.0.15, and the error goes away. Then I switch back to 14.1.0 or 14.1.1 branch, and I get the error. Did something change with JavaScript handling in 14.1.x? I see nothing in the update documents, but maybe I missed something? I am litterally switching between two branches that only differ in respect to the version of Vaadin being used, my source code does not change between these two versions.
![LogToConsoleError]
(https://i.postimg.cc/P5CkGw4m/log-To-Console-Not-Defined.png)
Figure 2: Log To Console error
![addBeforeUnloadListenerError]
(https://i.postimg.cc/mrWpdz6Z/add-Before-Unload-Listener-Not-Defined.png)
Figure 3: Add before unload listener error
NOTE: I have a Vaadin 7 app wrapped inside MPR. I use hardly any Flow components, at this point. In fact, most of my flow logic is limited to the entry point ( class with @Route("")
).
NOTE 2: So far the only problem is this “not defined” issue.