Skip to content
Merged
Changes from all commits
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
13 changes: 7 additions & 6 deletions packages/event-bus-client/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ export class EventClient<
this.#connected = false
this.#connectIntervalId = null
this.#connectEveryMs = 500

if (typeof CustomEvent !== 'undefined') {
this.#connectFunction()
this.startConnectLoop()
}
}

private startConnectLoop() {
Expand Down Expand Up @@ -188,11 +183,17 @@ export class EventClient<
// wait to connect to the bus
if (!this.#connected) {
this.debugLog('Bus not available, will be pushed as soon as connected')
return this.#queuedEvents.push({
this.#queuedEvents.push({
type: `${this.#pluginId}:${eventSuffix}`,
payload,
pluginId: this.#pluginId,
})
// start connection to event bus
if (typeof CustomEvent !== 'undefined') {
this.#connectFunction()
this.startConnectLoop()
}
return
}
// emit right now
return this.emitEventToBus({
Expand Down
Loading