Skip to content

Design flaw: storing NAPI constructors as static persistent references is not sustainable #66

Description

@syntheticmagus

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions