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

关于protocol设置的问题 #23

Open
brandlee opened this issue Jul 2, 2019 · 3 comments
Open

关于protocol设置的问题 #23

brandlee opened this issue Jul 2, 2019 · 3 comments

Comments

@brandlee
Copy link

brandlee commented Jul 2, 2019

对于JsBridgeConfig.getSetting().setProtocol(),这个方法,貌似只能设置一次protocol,而且再也无法更改了。感觉这样不太灵活,希望能够在release的时候清空protocol的信息,或者能够支持protocol的更改

@pengwei1024
Copy link
Owner

public static JsBridge loadModule(@NonNull String protocol, @NonNull String readyMethod, JsModule...modules) {
        return new JsBridgeImpl(protocol, readyMethod, modules);
    }

JsBridge里面有个loadModule可以设置任意protocol 呀

@dengzhenyu
Copy link

JBUtilMethodFactory中:
public static String getUtilMethods(String loadReadyMethod) { if (injectFunc == null) { JsRunMethod[] methods = new JsRunMethod[]{new GetType(), new ParseFunction(), new OnJsBridgeReady(loadReadyMethod), new CreateID(), new CallJava(), new Printer() }; injectFunc = new StringBuffer(); for (JsRunMethod method : methods) { injectFunc.append(method.getMethod()); } } return injectFunc.toString(); }
injectFunc这个静态属性,不为空的时候不能重置,导致重新设置的loadReadyMethod这个名字无效。也就是说即使设置多次protocol或者method,只有第一次设置的生效。

@pengwei1024
Copy link
Owner

JBUtilMethodFactory中:
public static String getUtilMethods(String loadReadyMethod) { if (injectFunc == null) { JsRunMethod[] methods = new JsRunMethod[]{new GetType(), new ParseFunction(), new OnJsBridgeReady(loadReadyMethod), new CreateID(), new CallJava(), new Printer() }; injectFunc = new StringBuffer(); for (JsRunMethod method : methods) { injectFunc.append(method.getMethod()); } } return injectFunc.toString(); }
injectFunc这个静态属性,不为空的时候不能重置,导致重新设置的loadReadyMethod这个名字无效。也就是说即使设置多次protocol或者method,只有第一次设置的生效。

是的,JBUtilMethodFactory里面注入了一些静态方法,避免频繁操作就缓存起来了。后续我优化下这块,多谢反馈

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

No branches or pull requests

3 participants