package com.mayi.demo.web;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

import com.mayi.demo.R;
import com.mayi.fastdevelop.web.DWebView;
import com.mayi.fastdevelop.web.JsCallAppApi;

public class JavascriptCallNativeActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_js_call_native);
        final DWebView dwebView=  findViewById(R.id.webview);
        // set debug mode
        DWebView.setWebContentsDebuggingEnabled(true);
        dwebView.addJavascriptObject(new JsApi(), null);
        dwebView.addJavascriptObject(new JsEchoApi(),"echo");
        dwebView.loadUrl("file:///android_asset/js-call-native.html");
    }
}
