Skip to content

Realm handle multiple instances #6883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/compiler/src/experimental/realm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { Program } from "../core/program.js";
import { Type } from "../core/types.js";
import { createTypekit, Typekit } from "./typekit/index.js";

(globalThis as any).realmForType ??= new WeakMap<Type, Realm>();

/**
* A Realm's view of a Program's state map for a given state key.
*
Expand Down Expand Up @@ -234,5 +236,5 @@ export class Realm {
return this.#types;
}

static realmForType = new WeakMap<Type, Realm>();
static realmForType = (globalThis as any).realmForType;
}
Loading