In many places where we create JavaScript types using NAPI, we store off a copy of the constructor as a private static Napi::FunctionReference within the C++ type. This will probably not work if/once we have multiple simultaneous runtimes as the constructors for the second runtime will replace those of the first. Moreover, this is not probably not necessary, since the constructors should be owned by the JavaScript global context (at least in the majority of cases) and probably shouldn't be kept by native at all.
In many places where we create JavaScript types using NAPI, we store off a copy of the constructor as a private static Napi::FunctionReference within the C++ type. This will probably not work if/once we have multiple simultaneous runtimes as the constructors for the second runtime will replace those of the first. Moreover, this is not probably not necessary, since the constructors should be owned by the JavaScript global context (at least in the majority of cases) and probably shouldn't be kept by native at all.