From 271608f7e9565c06a5e4e4ba0d64b6f4cc9cf107 Mon Sep 17 00:00:00 2001 From: Marcin S Date: Tue, 21 Dec 2021 11:22:03 -0600 Subject: [PATCH] Enforce singleton pattern for MySky --- src/mysky/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mysky/index.ts b/src/mysky/index.ts index d1411f69..05a5691f 100644 --- a/src/mysky/index.ts +++ b/src/mysky/index.ts @@ -150,6 +150,10 @@ export class MySky { protected hostDomain: string, protected currentPortalUrl: string ) { + if (MySky.instance) { + throw new Error("Trying to create a second MySky instance"); + } + this.pendingPermissions = permissions; }