// Copyright 2018-present 650 Industries. All rights reserved. #import #import #import #import #import #import #import #import #import namespace jsi = facebook::jsi; /** Property name used to define the modules host object in the main object of the Expo JS runtime. */ static NSString *modulesHostObjectPropertyName = @"modules"; @implementation EXJavaScriptRuntimeManager { std::shared_ptr _runtime; } - (nonnull instancetype)initWithRuntime:(nonnull void *)runtime { if (self = [super init]) { // Make shared pointer that points to the runtime but doesn't own it, thus doesn't release it. _runtime = std::shared_ptr(std::shared_ptr(), reinterpret_cast(runtime)); } return self; } #pragma mark - Installing JSI bindings - (void)installSharedObjectClass:(void (^_Nonnull)(long))releaser { expo::SharedObject::installBaseClass(*_runtime, [releaser](expo::SharedObject::ObjectId objectId) { releaser(objectId); }); } - (void)installSharedRefClass { expo::SharedRef::installBaseClass(*_runtime); } - (void)installEventEmitterClass { expo::EventEmitter::installClass(*_runtime); } - (void)installNativeModuleClass { expo::NativeModule::installClass(*_runtime); } @end