Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/3868 wkwebview inspectable #3869

Merged
merged 2 commits into from
Feb 8, 2025

Conversation

shannah
Copy link
Collaborator

@shannah shannah commented Feb 1, 2025

Adds support for making iOS webview debuggable in safari. #3868

Use the setDebug(true) method on the webview.

package ca.weblite.jcbtest;

import static com.codename1.ui.CN.*;
import com.codename1.system.Lifecycle;
import com.codename1.ui.*;
import com.codename1.ui.layouts.*;
import com.codename1.io.*;
import com.codename1.ui.plaf.*;
import com.codename1.ui.util.Resources;

/**
 * This file was generated by <a href="https://www.codenameone.com/">Codename One</a> for the purpose
 * of building native mobile applications using Java.
 */
public class JSCallbackTest extends Lifecycle {
    @Override
    public void runApp() {
        Form hi = new Form("Browser", new BorderLayout());
        BrowserComponent browser = new BrowserComponent();
        browser.setDebugMode(true);
        browser.setURL("https://www.codenameone.com/");
        browser.addWebEventListener(BrowserComponent.onLoad, evt -> {
            browser.addJSCallback("window.myCallback = function(args) {callback.onSuccess(args)};"
                    , (args) -> {
                System.out.println("Hello: " + args);
            });
        });
        hi.add(BorderLayout.CENTER, browser);
        Button btn = new Button("Hello");
        btn.addActionListener(e -> {
            browser.execute("myCallback('Hello from Java')");
        });
        hi.add(BorderLayout.SOUTH, btn);
        hi.show();
    }
}

@shannah shannah merged commit 898f4d6 into master Feb 8, 2025
1 check passed
@shannah shannah deleted the feature/3868-wkwebview-inspectable branch February 8, 2025 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant