From dce469e605c46f8f42e3c7a9ca255011d21890bd Mon Sep 17 00:00:00 2001 From: T6 Date: Mon, 8 May 2023 14:03:12 -0400 Subject: [PATCH] feat: warn on multiple instances of capi (#979) --- mod.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mod.ts b/mod.ts index 4a2bc89d7..10cf32945 100644 --- a/mod.ts +++ b/mod.ts @@ -1,3 +1,9 @@ +const CAPI_MARKER = Symbol.for("paritytech/capi") +if (CAPI_MARKER in globalThis) { + console.warn("Multiple instances of Capi loaded -- this will lead to unexpected behavior!") +} +;(globalThis as any)[CAPI_MARKER] = true + export * as $ from "./deps/scale.ts" export { BitSequence } from "./deps/scale.ts" export * from "./server/client/mod.ts"