Skip to content

Commit d68d7a0

Browse files
authored
add flag to keep working old observables till explroer reaches prod (#934)
1 parent 6d2ec97 commit d68d7a0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/@dcl/sdk/src/observables.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,16 @@ export interface IEvents {
101101
}
102102
}
103103

104+
// Remove this once new components/observables reaches production.
105+
const __OBSERVABLES_FALLBACK_SUPPORT = true
104106
/**
105107
* @internal
106108
* This function generates a callback that is passed to the Observable
107109
* constructor to subscribe to the events of the DecentralandInterface
108110
*/
109111
function createSubscriber(eventName: keyof IEvents) {
110112
return () => {
111-
if (eventName === 'comms' || (globalThis as any).__OBSERVABLES_FALLBACK_SUPPORT) {
113+
if (eventName === 'comms' || __OBSERVABLES_FALLBACK_SUPPORT) {
112114
subscribe({ eventId: eventName }).catch(console.error)
113115
} else {
114116
SDK7ComponentsObservable?.subscribe(eventName)
@@ -263,7 +265,7 @@ export async function pollEvents(sendBatch: (body: ManyEntityAction) => Promise<
263265

264266
const SDK7ComponentsObservable = processObservables()
265267
function processObservables() {
266-
if ((globalThis as any).__OBSERVABLES_FALLBACK_SUPPORT) return
268+
if (__OBSERVABLES_FALLBACK_SUPPORT) return
267269
const subscriptions = new Set<keyof IEvents>()
268270

269271
function subscribe(eventName: keyof IEvents) {

0 commit comments

Comments
 (0)