Sha256: c349cedc9f6a24359a9374749e8ece852d7b90bf538bdde5b6fa52757997ab75

Contents?: true

Size: 790 Bytes

Versions: 3

Compression:

Stored size: 790 Bytes

Contents

# frozen_string_literal: true

require "active_support/concern"

module StimulusReflex
  module CableReadiness
    extend ActiveSupport::Concern

    prepended do
      attr_reader :cable_ready
    end

    def initialize(*args, **kwargs)
      super(*args, **kwargs)

      if is_a? CableReady::Broadcaster
        message = <<~MSG

          #{self.class.name} includes CableReady::Broadcaster, and you need to remove it.
          Reflexes have their own CableReady interface. You can just assume that it's present.
          See https://docs.stimulusreflex.com/guide/cableready#using-cableready-inside-a-reflex-action for more details.

        MSG
        raise TypeError.new(message.strip)
      end
      @cable_ready = StimulusReflex::CableReadyChannels.new(self)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
stimulus_reflex-3.5.0.rc2 lib/stimulus_reflex/cable_readiness.rb
stimulus_reflex-3.5.0.rc1 lib/stimulus_reflex/cable_readiness.rb
stimulus_reflex-3.5.0.pre10 lib/stimulus_reflex/cable_readiness.rb