New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

stimulus_reflex

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stimulus_reflex - npm Package Compare versions

Comparing version 3.1.2 to 3.1.3

31

consumer.js
import { createConsumer } from '@rails/actioncable'
function connectionOpened () {
document.body.removeAttribute('data-action-cable-disconnected')
document.body.setAttribute('data-action-cable-connected', '')
}
function connectionClosed () {
document.body.removeAttribute('data-action-cable-connected')
document.body.setAttribute('data-action-cable-disconnected', '')
}
function isConsumer (object) {

@@ -36,25 +26,4 @@ if (object) {

export function registerConsumer (consumer) {
const connection = consumer ? consumer.connection : null
const socket = connection ? connection.webSocket : null
try {
socket.removeEventListener('open', connectionOpened)
socket.addEventListener('open', connectionOpened)
socket.removeEventListener('close', connectionClosed)
socket.addEventListener('close', connectionClosed)
socket.removeEventListener('error', connectionClosed)
socket.addEventListener('error', connectionClosed)
connection.isOpen() ? connectionOpened() : connectionClosed()
} catch (error) {
console.error(
"StimulusReflex was unable to register the ActionCable consumer. Don't worry, everything should still work.",
consumer,
connection,
socket
)
}
}
export function getConsumer () {
return findConsumer(window) || createConsumer()
}

2

package.json
{
"name": "stimulus_reflex",
"version": "3.1.2",
"version": "3.1.3",
"description": "Build reactive applications with the Rails tooling you already know and love.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -5,3 +5,3 @@ import { Controller } from 'stimulus'

import { defaultSchema } from './schema'
import { getConsumer, registerConsumer } from './consumer'
import { getConsumer } from './consumer'
import { dispatchLifecycleEvent } from './lifecycle'

@@ -54,4 +54,2 @@ import { allReflexControllers } from './controllers'

actionCableConsumer = actionCableConsumer || getConsumer()
registerConsumer(actionCableConsumer)
const { channel } = controller.StimulusReflex

@@ -58,0 +56,0 @@ const identifier = JSON.stringify({ channel })

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc