Let JS modules use strings instead of ids on Android

Reviewed By: nicklockwood

Differential Revision: D3229626

fb-gh-sync-id: f8b2e8c9fc0d25d67f623cdbbe9930a02a40d1de
fbshipit-source-id: f8b2e8c9fc0d25d67f623cdbbe9930a02a40d1de
This commit is contained in:
Alexander Blom authored and Facebook Github Bot 4 committed 2016-05-04 10:29:26 -07:00
1 parent 5071907b27
commit 041185edfd
11 files changed
+45 -82

No files matched your search

@@ -42,11 +42,11 @@ public class JavaScriptModulesConfig {
private void appendJSModuleToJSONObject(
JsonWriter writer,
JavaScriptModuleRegistration registration) throws IOException {
writer.name("moduleID").value(registration.getModuleId());
writer.name("moduleID").value(registration.getName());
writer.name("methods").beginObject();
for (Method method : registration.getMethods()) {
writer.name(method.getName()).beginObject();
writer.name("methodID").value(registration.getMethodId(method));
writer.name("methodID").value(method.getName());
writer.endObject();
}
writer.endObject();
@@ -56,14 +56,11 @@ public class JavaScriptModulesConfig {
}
public static class Builder {
private int mLastJSModuleId = 0;
private List<JavaScriptModuleRegistration> mModules =
new ArrayList<JavaScriptModuleRegistration>();
public Builder add(Class<? extends JavaScriptModule> moduleInterfaceClass) {
int moduleId = mLastJSModuleId++;
mModules.add(new JavaScriptModuleRegistration(moduleId, moduleInterfaceClass));
mModules.add(new JavaScriptModuleRegistration(moduleInterfaceClass));
return this;
}