Sha256: f098e3966010a0d3427822c98f7e039982170ad66ee056df5f9e7b34ea49ba1c
Contents?: true
Size: 692 Bytes
Versions: 32
Compression:
Stored size: 692 Bytes
Contents
import { createConsumer } from "@rails/actioncable"; import debounce from "debounce"; export default function socket(endpoint) { const uid = (Date.now() + ((Math.random() * 100) | 0)).toString(); const consumer = createConsumer(`${endpoint}?uid=${uid}`); return { addListener(channel, callback) { consumer.subscriptions.create(channel, { received: debounce((data) => { console.log("Lookbook files changed"); callback(data); }, 200), connected() { console.log("Lookbook websocket connected"); }, disconnected() { console.log("Lookbook websocket disconnected"); }, }); }, }; }
Version data entries
32 entries across 32 versions & 1 rubygems