How to use the create-subscription/cjs/create-subscription.production.min.js.createSubscription function in create-subscription

To help you get started, weโ€™ve selected a few create-subscription examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pomber / hitchcock / packages / hitchcock / src / director.js View on Github external
import React from "react";
import glamorous from "glamorous";
import { cachePublisher as cache, WAITING, RUNNING, PAUSED, DONE } from "./spy";
import { createSubscription } from "create-subscription/cjs/create-subscription.production.min.js";
import Draggable from "react-draggable";
import ReactDOM from "react-dom";

const Subscription = createSubscription({
  getCurrentValue(source) {
    return source.getCurrentValue();
  },
  subscribe(source, callback) {
    const onChange = () => callback(source.getCurrentValue());
    source.subscribe(onChange);
    return function unsubscribe() {
      source.unsubscribe(onChange);
    };
  }
});

const clickable = {
  // cursor: "pointer",
  transition: "transform 70ms",
  ":hover": {

create-subscription

utility for subscribing to external data sources inside React components

MIT
Latest version published 2 years ago

Package Health Score

69 / 100
Full package analysis

Similar packages