本文整理汇总了Java中com.facebook.stetho.rhino.JsRuntimeReplFactoryBuilder类的典型用法代码示例。如果您正苦于以下问题:Java JsRuntimeReplFactoryBuilder类的具体用法?Java JsRuntimeReplFactoryBuilder怎么用?Java JsRuntimeReplFactoryBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JsRuntimeReplFactoryBuilder类属于com.facebook.stetho.rhino包,在下文中一共展示了JsRuntimeReplFactoryBuilder类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createWebkitModulesProvider
import com.facebook.stetho.rhino.JsRuntimeReplFactoryBuilder; //导入依赖的package包/类
private InspectorModulesProvider createWebkitModulesProvider() {
return () -> new Stetho.DefaultInspectorModulesBuilder(context).runtimeRepl(
new JsRuntimeReplFactoryBuilder(context)
.addFunction("activity", new BaseFunction() {
@Override
public Object call(org.mozilla.javascript.Context cx, Scriptable scope, Scriptable thisObj, Object[] args) {
return activityProvider.getCurrentActivity();
}
}).build()
).finish();
}
示例2: onCreate
import com.facebook.stetho.rhino.JsRuntimeReplFactoryBuilder; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
if (null == demoAppContext) {
demoAppContext = getApplicationContext();
}
// queues = Volley.newRequestQueue(demoAppContext);
// CrashHandler crashHandler = CrashHandler.getInstance();
// crashHandler.init(getApplicationContext());
// crashHandler.initActivityContainer(container);
container = new ArrayList<>(5);
if (Constants.IS_OPEN_UI_BLOCK_CANARY) {
sContext = this;
BlockCanary.install(this, new DemoBlockCanaryContext()).start();
}
if (Constants.IS_OPEN_LEAK_CANARY) {
refWatcher = initLeakCanary();
}
if (Constants.IS_OPEN_STETHO) {
// 查看 dumpapp 信息
// Stetho.initialize(Stetho.newInitializerBuilder(this).enableDumpapp(new DumperPluginsProvider() {
// @Override
// public Iterable<DumperPlugin> get() {
// return new Stetho.DefaultDumperPluginsBuilder(DemoApplication.this).provide(new HelloWorldDumperPlugin()).provide(new APODDumperPlugin(DemoApplication.this.getContentResolver())).finish();
// }
// }).enableWebKitInspector(new ExtInspectorModulesProvider(DemoApplication.this)).build());
// 调用 JS
Stetho.initialize(Stetho.newInitializerBuilder(DemoApplication.this).enableWebKitInspector(new InspectorModulesProvider() {
@Override
public Iterable<ChromeDevtoolsDomain> get() {
return new Stetho.DefaultInspectorModulesBuilder(DemoApplication.this).runtimeRepl(new JsRuntimeReplFactoryBuilder(DemoApplication.this)
// Pass to JavaScript: var foo = "bar";
.addVariable("foo", "bar").build()).finish();
}
}).build());
}
}