android: expose doric's library and registry

This commit is contained in:
pengfei.zhou 2022-06-02 19:47:38 +08:00 committed by osborn
parent e62bfa315e
commit 19a8aaae94
2 changed files with 4 additions and 4 deletions

View File

@ -93,7 +93,7 @@ public class DoricRegistry {
private void initRegistry(DoricRegistry doricRegistry) { private void initRegistry(DoricRegistry doricRegistry) {
for (DoricLibrary library : DoricSingleton.getInstance().doricLibraries) { for (DoricLibrary library : DoricSingleton.getInstance().libraries) {
library.load(doricRegistry); library.load(doricRegistry);
} }
} }

View File

@ -33,8 +33,8 @@ import pub.doric.loader.DoricJSLoaderManager;
public class DoricSingleton { public class DoricSingleton {
final Map<String, String> bundles = new ConcurrentHashMap<>(); final Map<String, String> bundles = new ConcurrentHashMap<>();
final Set<DoricLibrary> doricLibraries = new HashSet<>(); public final Set<DoricLibrary> libraries = new HashSet<>();
final List<WeakReference<DoricRegistry>> registries = new ArrayList<>(); public final List<WeakReference<DoricRegistry>> registries = new ArrayList<>();
final Map<String, Object> envMap = new ConcurrentHashMap<>(); final Map<String, Object> envMap = new ConcurrentHashMap<>();
private final DoricJSLoaderManager jsLoaderManager = new DoricJSLoaderManager(); private final DoricJSLoaderManager jsLoaderManager = new DoricJSLoaderManager();
@ -58,7 +58,7 @@ public class DoricSingleton {
public void registerLibrary(DoricLibrary doricLibrary) { public void registerLibrary(DoricLibrary doricLibrary) {
doricLibraries.add(doricLibrary); libraries.add(doricLibrary);
for (WeakReference<DoricRegistry> registryWeakReference : registries) { for (WeakReference<DoricRegistry> registryWeakReference : registries) {
DoricRegistry registry = registryWeakReference.get(); DoricRegistry registry = registryWeakReference.get();
if (registry != null) { if (registry != null) {