feat:add set environment value api

This commit is contained in:
pengfei.zhou
2021-07-07 17:30:08 +08:00
committed by osborn
parent 0c10b513b9
commit e6595d5c51
18 changed files with 157 additions and 30 deletions

View File

@@ -51,7 +51,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)teardown;
- (void)setEnvironment:(NSString *)key variable:(id)value;
- (void)setEnvironmentValue:(NSDictionary *)value;
@end
NS_ASSUME_NONNULL_END

View File

@@ -106,9 +106,9 @@ - (instancetype)init {
return self;
}
- (void)setEnvironment:(NSString *)key variable:(id)value {
- (void)setEnvironmentValue:(NSDictionary *)value {
[self ensureRunOnJSThread:^{
self.environmentDictionary[key] = value;
[self.environmentDictionary addEntriesFromDictionary:value];
if (self.initialized) {
[self.jsExecutor injectGlobalJSObject:INJECT_ENVIRONMENT obj:[self.environmentDictionary copy]];
for (DoricContext *doricContext in DoricContextManager.instance.aliveContexts) {