Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (err) {
console.log(`Watch error: ${err}`)
cb({ error: err })
} else {
// Update balance
const accData = await grabProviderState(fakeProvider as any)
cb(accData)
}
})
},
unsubscribe() {
// return filter.stopWatching()
},
}
const Subscription: any = createSubscription({
getCurrentValue(source: any) {
// Return the current value of the subscription (source),
// or `undefined` if the value can't be read synchronously (e.g. native Promises).
return source.currenState
},
subscribe(eventDispatcher: any, callback: any) {
// Subscribe (e.g. add an event listener) to the subscription (source).
// Call callback(newValue) whenever a subscription changes.
// Return an unsubscribe method,
// Or a no-op if unsubscribe is not supported (e.g. native Promises).
eventDispatcher.subscribe(callback)
return () => eventDispatcher.unsubscribe()
},
})
import {createSubscription} from 'create-subscription';
const Subscription = createSubscription({
getCurrentValue(sourceProp) {
// Return the current value of the subscription (sourceProp).
return sourceProp.value;
},
subscribe(sourceProp, callback) {
function handleSubscriptionChange() {
callback(sourceProp.value);
}
// Subscribe (e.g. add an event listener) to the subscription (sourceProp).
// Call callback(newValue) whenever a subscription changes.
sourceProp.subscribe(handleSubscriptionChange);
// Return an unsubscribe method.
return function unsubscribe() {
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": {
private getSubscriptionComponent() {
const SubscriptionComponent = createSubscription, T | undefined>({
getCurrentValue(_observable) {
return undefined;
},
subscribe(observable, callback) {
const subscription = observable.subscribe(callback);
return () => subscription.unsubscribe();
},
});
return SubscriptionComponent;
}
}