- return GLOBAL_THIS_ + mapName;
- }
-
- /**
- * Execute this JavaScript on the client side after making sure that the page
- * has been loaded and the map object has been created.
- *
- * @param js the JavaScript code, possibly formatted according to
- * {@link String#format}, with {@link Locale#ROOT} as locale (for
- * stability of decimal separator, as expected by JavaScript.
- * @param args the optional arguments of
- * {@link String#format(String, Object...)}
- */
- protected CompletionStage<Object> evaluate(String js, Object... args) {
- CompletableFuture<Object> res = pageLoaded.thenApply((ready) -> {
- if (!ready)
- throw new IllegalStateException("Map " + mapName + " is not initialised.");
- Object result = browser.evaluate(String.format(Locale.ROOT, js, args));
- return result;
- });
- return res.minimalCompletionStage();
- }
-
- protected void loadExtension(String url) {
-// String js = """
-// var script = document.createElement("script");
-// script.src = '%s';
-// document.head.appendChild(script);
-// """;
-// browser.evaluate(String.format(Locale.ROOT, js, url));
- browser.evaluate(String.format(Locale.ROOT, "import('%s')", url));
- }
-
- /** To be overridden with calls to {@link #loadExtension(String)}. */
- protected void loadExtensions() {
-