raid-addons
Version:
Add-ons functions for use with Raid
39 lines (36 loc) • 994 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.plug = void 0;
var _createAdaptor = require("./createAdaptor");
// const identity = _ => _
//
// export const plug = signal => {
// let internalState = {}
// signal.observe(state => {
// internalState = state
// })
// return function connect (selector, fn) {
// if (fn && !selector) {
// throw new Error('No state selector for connected function')
// }
//
// // selector is optional, if it is omitted then assume the first
// // argument is the connected function
// const select = fn ? selector : identity
// const func = fn || selector
//
// return _ => {
// let state = select(internalState)
// return func(state, _)
// }
// }
// }
var plug = (0, _createAdaptor.createAdaptor)(function (select, getState, func) {
return function (props) {
var state = select(getState());
return func(state, props);
};
});
exports.plug = plug;
;