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-2.0.11 app/javascript/turbo/cable.js
turbo-rails-2.0.10 app/javascript/turbo/cable.js
turbo-rails-2.0.9 app/javascript/turbo/cable.js
turbo-rails-2.0.8 app/javascript/turbo/cable.js
turbo-rails-2.0.7 app/javascript/turbo/cable.js
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/turbo-rails-2.0.5/app/javascript/turbo/cable.js
turbo-rails-2.0.6 app/javascript/turbo/cable.js
turbo-rails-2.0.5 app/javascript/turbo/cable.js
turbo-rails-2.0.4 app/javascript/turbo/cable.js
turbo-rails-2.0.3 app/javascript/turbo/cable.js
turbo-rails-2.0.2 app/javascript/turbo/cable.js
turbo-rails-2.0.1 app/javascript/turbo/cable.js
turbo-rails-2.0.0 app/javascript/turbo/cable.js
turbo-rails-2.0.0.pre.rc.3 app/javascript/turbo/cable.js
turbo-rails-2.0.0.pre.rc.2 app/javascript/turbo/cable.js
turbo-rails-2.0.0.pre.rc.1 app/javascript/turbo/cable.js
turbo-rails-2.0.0.pre.beta.4 app/javascript/turbo/cable.js
turbo-rails-2.0.0.pre.beta.3 app/javascript/turbo/cable.js
turbo-rails-2.0.0.pre.beta.2 app/javascript/turbo/cable.js
turbo-rails-2.0.0.pre.beta.1 app/javascript/turbo/cable.js