cable_ready
Advanced tools
Comparing version 5.0.0-pre3 to 5.0.0-pre4
# Changelog | ||
## [v5.0.0.pre3](https://github.com/stimulusreflex/cable_ready/tree/v5.0.0.pre3) (2021-08-22) | ||
[Full Changelog](https://github.com/stimulusreflex/cable_ready/compare/v5.0.0.pre2...v5.0.0.pre3) | ||
**Implemented enhancements:** | ||
- redirect\_to operation [\#144](https://github.com/stimulusreflex/cable_ready/pull/144) ([leastbad](https://github.com/leastbad)) | ||
- RFC simplifed JSON payload + named batches [\#142](https://github.com/stimulusreflex/cable_ready/pull/142) ([leastbad](https://github.com/leastbad)) | ||
**Merged pull requests:** | ||
- Bump path-parse from 1.0.6 to 1.0.7 [\#143](https://github.com/stimulusreflex/cable_ready/pull/143) ([dependabot[bot]](https://github.com/apps/dependabot)) | ||
## [v5.0.0.pre2](https://github.com/stimulusreflex/cable_ready/tree/v5.0.0.pre2) (2021-07-21) | ||
@@ -4,0 +17,0 @@ |
export let consumer | ||
const wait = () => new Promise(resolve => setTimeout(resolve)) | ||
const retryGetConsumer = async () => { | ||
if (!consumer) { | ||
await wait() | ||
return retryGetConsumer() | ||
} else { | ||
return consumer | ||
} | ||
} | ||
export default { | ||
setConsumer (value) { | ||
consumer = value | ||
}, | ||
async getConsumer () { | ||
return new Promise((resolve, reject) => { | ||
consumer = retryGetConsumer() | ||
resolve(consumer) | ||
}) | ||
} | ||
} |
@@ -7,2 +7,3 @@ import * as MorphCallbacks from './morph_callbacks' | ||
import './stream_from_element' | ||
import './updates_for_element' | ||
@@ -9,0 +10,0 @@ export { Utils, MorphCallbacks } |
@@ -1,7 +0,8 @@ | ||
import CableReady from 'cable_ready' | ||
import { consumer } from './action_cable' | ||
import CableReady from '.' | ||
import actionCable from './action_cable' | ||
class StreamFromElement extends HTMLElement { | ||
connectedCallback () { | ||
async connectedCallback () { | ||
if (this.preview) return | ||
const consumer = await actionCable.getConsumer() | ||
if (consumer) { | ||
@@ -21,3 +22,3 @@ this.channel = consumer.subscriptions.create( | ||
console.error( | ||
'The `stream_from` helper cannot connect without an ActionCable consumer.\nPlease run `rails generate cable_ready:stream_from` to fix this.' | ||
'The `stream_from` helper cannot connect without an ActionCable consumer.\nPlease run `rails generate cable_ready:helpers` to fix this.' | ||
) | ||
@@ -24,0 +25,0 @@ } |
@@ -104,2 +104,11 @@ import { inputTags, textInputTypes } from './enums' | ||
// Boris de bouncer | ||
function Boris (func, timeout) { | ||
let timer | ||
return (...args) => { | ||
clearTimeout(timer) | ||
timer = setTimeout(() => func.apply(this, args), timeout) | ||
} | ||
} | ||
export { | ||
@@ -114,3 +123,4 @@ isTextInput, | ||
before, | ||
after | ||
after, | ||
Boris | ||
} |
{ | ||
"name": "cable_ready", | ||
"version": "5.0.0-pre3", | ||
"version": "5.0.0-pre4", | ||
"description": "CableReady helps you create great real-time user experiences by making it simple to trigger client-side DOM changes from server-side Ruby.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -5,4 +5,8 @@ <p align="center"> | ||
<p align="center"> | ||
<img src="https://img.shields.io/gem/v/cable_ready.svg?color=red" /> | ||
<img src="https://img.shields.io/npm/v/cable_ready.svg?color=blue" /> | ||
<a href="https://rubygems.org/gems/cable_ready"> | ||
<img src="https://img.shields.io/gem/v/cable_ready.svg?color=red" /> | ||
</a> | ||
<a href="https://www.npmjs.com/package/cable_ready"> | ||
<img src="https://img.shields.io/npm/v/cable_ready.svg?color=blue" /> | ||
</a> | ||
<a href="https://www.npmjs.com/package/cable_ready"> | ||
@@ -9,0 +13,0 @@ <img alt="downloads" src="https://img.shields.io/npm/dm/cable_ready.svg?color=blue" target="_blank" /> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 4 instances in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
356246
52
879
94
5