Sha256: 2d670afca3bd112e47654d341192238654971100cfe76a829781124ff327b17d

Contents?: true

Size: 526 Bytes

Versions: 57

Compression:

Stored size: 526 Bytes

Contents

let consumer

export async function getConsumer() {
  return consumer || setConsumer(createConsumer().then(setConsumer))
}

export function setConsumer(newConsumer) {
  return consumer = newConsumer
}

export async function createConsumer() {
  const { createConsumer } = await import(/* webpackChunkName: "actioncable" */ "@rails/actioncable/src")
  return createConsumer()
}

export async function subscribeTo(channel, mixin) {
  const { subscriptions } = await getConsumer()
  return subscriptions.create(channel, mixin)
}

Version data entries

57 entries across 57 versions & 3 rubygems

Version Path
turbo-rails-0.7.13 app/javascript/turbo/cable.js
turbo-rails-0.7.12 app/javascript/turbo/cable.js
turbo-rails-0.7.11 app/javascript/turbo/cable.js
turbo-rails-0.7.10 app/javascript/turbo/cable.js
turbo-rails-0.7.9 app/javascript/turbo/cable.js
turbo-rails-0.7.8 app/javascript/turbo/cable.js
turbo-rails-0.7.7 app/javascript/turbo/cable.js
turbo-rails-0.7.6 app/javascript/turbo/cable.js
turbo-rails-0.7.5 app/javascript/turbo/cable.js
turbo-rails-0.7.4 app/javascript/turbo/cable.js
turbo-rails-0.7.2 app/javascript/turbo/cable.js
turbo-rails-0.7.1 app/javascript/turbo/cable.js
turbo-rails-0.7.0 app/javascript/turbo/cable.js
turbo-rails-0.6.0 app/javascript/turbo/cable.js
turbo-rails-0.5.12 app/javascript/turbo/cable.js
turbo-rails-0.5.11 app/javascript/turbo/cable.js
turbo-rails-0.5.10 app/javascript/turbo/cable.js