Skip to content

Commit

Permalink
add flag to keep working old observables till explroer reaches prod (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
gonpombo8 authored Apr 24, 2024
1 parent 6d2ec97 commit d68d7a0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/@dcl/sdk/src/observables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,16 @@ export interface IEvents {
}
}

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

const SDK7ComponentsObservable = processObservables()
function processObservables() {
if ((globalThis as any).__OBSERVABLES_FALLBACK_SUPPORT) return
if (__OBSERVABLES_FALLBACK_SUPPORT) return
const subscriptions = new Set<keyof IEvents>()

function subscribe(eventName: keyof IEvents) {
Expand Down

0 comments on commit d68d7a0

Please sign in to comment.