frint-react
Advanced tools
Comparing version 3.3.1 to 4.0.0
(function webpackUniversalModuleDefinition(root, factory) { | ||
if(typeof exports === 'object' && typeof module === 'object') | ||
module.exports = factory(require("react"), require("prop-types"), require("rxjs/BehaviorSubject"), require("react-dom"), require("lodash/isPlainObject"), require("rxjs/observable/of"), require("rxjs/observable/merge"), require("rxjs/operator/concatMap"), require("rxjs/operator/scan"), require("lodash/isEqual"), require("lodash/zipWith"), require("rxjs/operator/map")); | ||
module.exports = factory(require("react"), require("prop-types"), require("rxjs/BehaviorSubject"), require("react-dom"), require("lodash/isPlainObject"), require("rxjs/observable/of"), require("rxjs/observable/merge"), require("rxjs/operators/concatMap"), require("rxjs/operators/scan"), require("lodash/isEqual"), require("lodash/zipWith"), require("rxjs/operators/map")); | ||
else if(typeof define === 'function' && define.amd) | ||
define(["react", "prop-types", "rxjs/BehaviorSubject", "react-dom", "lodash/isPlainObject", "rxjs/observable/of", "rxjs/observable/merge", "rxjs/operator/concatMap", "rxjs/operator/scan", "lodash/isEqual", "lodash/zipWith", "rxjs/operator/map"], factory); | ||
define(["react", "prop-types", "rxjs/BehaviorSubject", "react-dom", "lodash/isPlainObject", "rxjs/observable/of", "rxjs/observable/merge", "rxjs/operators/concatMap", "rxjs/operators/scan", "lodash/isEqual", "lodash/zipWith", "rxjs/operators/map"], factory); | ||
else if(typeof exports === 'object') | ||
exports["FrintReact"] = factory(require("react"), require("prop-types"), require("rxjs/BehaviorSubject"), require("react-dom"), require("lodash/isPlainObject"), require("rxjs/observable/of"), require("rxjs/observable/merge"), require("rxjs/operator/concatMap"), require("rxjs/operator/scan"), require("lodash/isEqual"), require("lodash/zipWith"), require("rxjs/operator/map")); | ||
exports["FrintReact"] = factory(require("react"), require("prop-types"), require("rxjs/BehaviorSubject"), require("react-dom"), require("lodash/isPlainObject"), require("rxjs/observable/of"), require("rxjs/observable/merge"), require("rxjs/operators/concatMap"), require("rxjs/operators/scan"), require("lodash/isEqual"), require("lodash/zipWith"), require("rxjs/operators/map")); | ||
else | ||
root["FrintReact"] = factory(root["React"], root["PropTypes"], root["Rx"], root["ReactDOM"], root["_"]["isPlainObject"], root["Rx"]["Observable"], root["Rx"]["Observable"], root["Rx"]["Observable"]["prototype"], root["Rx"]["Observable"]["prototype"], root["_"]["isEqual"], root["_"]["zipWith"], root["Rx"]["Observable"]["prototype"]); | ||
root["FrintReact"] = factory(root["React"], root["PropTypes"], root["Rx"], root["ReactDOM"], root["_"]["isPlainObject"], root["Rx"]["Observable"], root["Rx"]["Observable"], root["Rx"]["operators"], root["Rx"]["operators"], root["_"]["isEqual"], root["_"]["zipWith"], root["Rx"]["operators"]); | ||
})(this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_7__, __WEBPACK_EXTERNAL_MODULE_11__, __WEBPACK_EXTERNAL_MODULE_14__, __WEBPACK_EXTERNAL_MODULE_15__, __WEBPACK_EXTERNAL_MODULE_16__, __WEBPACK_EXTERNAL_MODULE_17__, __WEBPACK_EXTERNAL_MODULE_18__, __WEBPACK_EXTERNAL_MODULE_24__, __WEBPACK_EXTERNAL_MODULE_25__, __WEBPACK_EXTERNAL_MODULE_28__) { | ||
@@ -591,5 +591,3 @@ return /******/ (function(modules) { // webpackBootstrap | ||
mappers.forEach(function (mapperFn) { | ||
var _context; | ||
mappedObject$ = (_context = mappedObject$, _concatMap.concatMap).call(_context, function (object) { | ||
mappedObject$ = mappedObject$.pipe((0, _concatMap.concatMap)(function (object) { | ||
var result = mapperFn(object); | ||
@@ -602,3 +600,3 @@ | ||
return (0, _of.of)(result); | ||
}); | ||
})); | ||
}); | ||
@@ -630,7 +628,5 @@ | ||
value: function get$() { | ||
var _context2; | ||
return (_context2 = _merge.merge.apply(undefined, _toConsumableArray(this._observables)), _scan.scan).call(_context2, function (props, emitted) { | ||
return _merge.merge.apply(undefined, _toConsumableArray(this._observables)).pipe((0, _scan.scan)(function (props, emitted) { | ||
return _extends({}, props, emitted); | ||
}); | ||
})); | ||
} | ||
@@ -1274,7 +1270,5 @@ }]); | ||
value: function getData$() { | ||
var _context; | ||
return (_context = this.props$, _map.map).call(_context, function (props) { | ||
return this.props$.pipe((0, _map.map)(function (props) { | ||
return props.data; | ||
}); | ||
})); | ||
} | ||
@@ -1281,0 +1275,0 @@ }]); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("prop-types"),require("rxjs/BehaviorSubject"),require("react-dom"),require("lodash/isPlainObject"),require("rxjs/observable/of"),require("rxjs/observable/merge"),require("rxjs/operator/concatMap"),require("rxjs/operator/scan"),require("lodash/isEqual"),require("lodash/zipWith"),require("rxjs/operator/map")):"function"==typeof define&&define.amd?define(["react","prop-types","rxjs/BehaviorSubject","react-dom","lodash/isPlainObject","rxjs/observable/of","rxjs/observable/merge","rxjs/operator/concatMap","rxjs/operator/scan","lodash/isEqual","lodash/zipWith","rxjs/operator/map"],t):"object"==typeof exports?exports.FrintReact=t(require("react"),require("prop-types"),require("rxjs/BehaviorSubject"),require("react-dom"),require("lodash/isPlainObject"),require("rxjs/observable/of"),require("rxjs/observable/merge"),require("rxjs/operator/concatMap"),require("rxjs/operator/scan"),require("lodash/isEqual"),require("lodash/zipWith"),require("rxjs/operator/map")):e.FrintReact=t(e.React,e.PropTypes,e.Rx,e.ReactDOM,e._.isPlainObject,e.Rx.Observable,e.Rx.Observable,e.Rx.Observable.prototype,e.Rx.Observable.prototype,e._.isEqual,e._.zipWith,e.Rx.Observable.prototype)}(this,function(e,t,n,r,o,u,a,i,s,c,l,f){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=9)}([function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.get("component"),n={app:e},r=function(e){return a.default.createElement(s.default,n,a.default.createElement(t,e))};return function(e){return a.default.createElement(r,e)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var u=n(0),a=r(u),i=n(4),s=r(i);e.exports=t.default},function(e,n){e.exports=t},function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),u=function(e){return e&&e.__esModule?e:{default:e}}(o);t.default={setData:function(e,t){this.component.setState(r({},e,t))},setDataWithCallback:function(e,t,n){this.component.setState(r({},e,t),n)},getData:function(e){return this.component.state[e]},getProps:function(){return this.component.props},getProp:function(e){return this.component.props[e]},getMountableComponent:u.default},e.exports=t.default},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(0),s=n(2),c=function(e){return e&&e.__esModule?e:{default:e}}(s),l=function(e){function t(e,n){r(this,t);var u=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return u.app=e.app,u}return u(t,e),a(t,[{key:"getChildContext",value:function(){return{app:this.app}}}]),a(t,[{key:"render",value:function(){return i.Children.only(this.props.children)}}]),t}(i.Component);l.propTypes={app:c.default.object.isRequired,children:c.default.element.isRequired},l.childContextTypes={app:c.default.object.isRequired},t.default=l,e.exports=t.default},function(e,t,n){"use strict";function r(e){return!(!e||"function"!=typeof e.subscribe)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(5),o=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=o.default,e.exports=t.default},function(e,t){e.exports=n},function(e,t,n){"use strict";function r(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];[a.default].concat(n).forEach(function(t){Object.keys(t).forEach(function(n){e[n]=t[n],"function"==typeof t[n]&&(e[n]=e[n].bind(e))})})}function o(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return new(Function.prototype.bind.apply(r,[null].concat(t)))}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var u=n(20),a=function(e){return e&&e.__esModule?e:{default:e}}(u);e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(10),u=r(o),a=n(12),i=r(a),s=n(6),c=r(s),l=n(1),f=r(l),p=n(19),d=r(p),h=n(22),b=r(h),y=n(4),v=r(y),_=n(26),g=r(_),m=n(3),j=r(m);t.default={render:u.default,streamProps:i.default,isObservable:c.default,getMountableComponent:f.default,observe:d.default,Region:b.default,Provider:v.default,RegionService:g.default,ReactHandler:j.default},e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r=(0,s.default)(e);return n(11).render(a.default.createElement(r,null),t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var u=n(0),a=r(u),i=n(1),s=r(i);e.exports=t.default},function(e,t){e.exports=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(13),o=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=o.default,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new _(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();t.default=i;var l=n(14),f=r(l),p=n(15),d=n(16),h=n(17),b=n(18),y=n(5),v=r(y),_=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e),this._observables=[(0,p.of)(t)]}return c(e,[{key:"_push",value:function(e){this._observables.push(e)}},{key:"set",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return"string"==typeof e?this.setKey(e,n[0]):(0,f.default)(e)?this.setPlainObject(e):(0,v.default)(e)?this.setObservable.apply(this,[e].concat(n)):this}},{key:"setKey",value:function(e,t){return this._push((0,p.of)(u({},e,t))),this}},{key:"setPlainObject",value:function(e){return this._push((0,p.of)(e)),this}},{key:"setObservable",value:function(e){for(var t=e,n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.forEach(function(e){var n;t=(n=t,h.concatMap).call(n,function(t){var n=e(t);return(0,v.default)(n)?n:(0,p.of)(n)})}),this._push(t),this}},{key:"setDispatch",value:function(e,t){var n={};return Object.keys(e).forEach(function(r){var o=e[r];n[r]=function(){return t.dispatch(o.apply(void 0,arguments))}}),this._push((0,p.of)(n)),this}},{key:"get$",value:function(){var e;return(e=d.merge.apply(void 0,o(this._observables)),b.scan).call(e,function(e,t){return s({},e,t)})}}]),e}();e.exports=t.default},function(e,t){e.exports=o},function(e,t){e.exports=u},function(e,t){e.exports=a},function(e,t){e.exports=i},function(e,t){e.exports=s},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function i(e){return function(t){var n=function(n){function r(t,n){o(this,r);var a=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,t,n));a._props$=new h.BehaviorSubject(a.props);var i="function"==typeof e?e(n.app,a._props$):{};return(0,P.default)(i)?(a._handler=(0,y.default)(m.default,_.default,{component:a,getProps$:function(){return i}}),a.state=a._handler.getInitialData(),a):(a.state={computedProps:i},u(a))}return a(r,n),c(r,[{key:"componentWillMount",value:function(){this._handler&&(this._handler.app=this.context.app,this._handler.beforeMount())}},{key:"componentWillReceiveProps",value:function(e){this._handler&&this._props$.next(e)}},{key:"componentWillUnmount",value:function(){this._handler&&this._handler.beforeDestroy()}},{key:"render",value:function(){var e=this.state.computedProps;return f.default.createElement(t,s({},e,this.props))}}]),r}(f.default.Component);return n.displayName=void 0!==t.displayName?"observe("+t.displayName+")":"observe",n.contextTypes={app:d.default.object.isRequired},n}}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();t.default=i;var l=n(0),f=r(l),p=n(2),d=r(p),h=n(7),b=n(8),y=r(b),v=n(21),_=r(v),g=n(3),m=r(g),j=n(6),P=r(j);e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={app:null,component:null,initialize:function(){},beforeDestroy:function(){},getInitialData:function(){return{}},setData:function(e,t){},setDataWithCallback:function(e,t,n){this.setData(e,t),n()},getData:function(e){},getProp:function(e){},getProps:function(){},beforeMount:function(){},afterMount:function(){},beforeUpdate:function(){},shouldUpdate:function(e,t){},afterUpdate:function(){},getMountableComponent:function(e){return e.get("component")}},e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={getProps$:null,getInitialData:function(){return{computedProps:{}}},beforeMount:function(){var e=this;"function"==typeof this.getProps$&&(this._subscription=this.getProps$(this.app).subscribe(function(t){e.setData("computedProps",t)}))},beforeDestroy:function(){this._subscription&&this._subscription.unsubscribe()}},e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(0),c=r(s),l=n(2),f=r(l),p=n(8),d=r(p),h=n(23),b=r(h),y=n(3),v=r(y),_=function(e){function t(){var e;o(this,t);for(var n=arguments.length,r=Array(n),a=0;a<n;a++)r[a]=arguments[a];var i=u(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(r)));return i._handler=(0,d.default)(v.default,b.default,{component:i}),i.state=i._handler.getInitialData(),i}return a(t,e),i(t,[{key:"shouldComponentUpdate",value:function(e,t){return this._handler.shouldUpdate(e,t)}},{key:"componentWillMount",value:function(){this._handler.app=this.context.app,this._handler.beforeMount()}},{key:"componentWillReceiveProps",value:function(e){this._handler.afterUpdate(e)}},{key:"componentWillUnmount",value:function(){this._handler.beforeDestroy()}},{key:"render",value:function(){var e=this.state.listForRendering;return 0===e.length?null:c.default.createElement("div",null,e.map(function(e){var t=e.Component,n=e.name;return c.default.createElement(t,{key:"app-"+n})}))}}]),t}(c.default.Component);_.propTypes={name:f.default.string.isRequired,uniqueKey:f.default.string,data:f.default.any},_.contextTypes={app:f.default.object},t.default=_,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(24),u=r(o),a=n(25),i=r(a);t.default={getInitialData:function(){return{list:[],listForRendering:[]}},sendProps:function(e,t){var n=e.get(e.options.providerNames.region);n&&n.emit(t)},beforeMount:function(){var e=this,t=this.app?this.app.getRootApp():window.app;if(t){this.rootApp=t;var n=t.getApps$(this.getProp("name"),this.getProp("uniqueKey"));this._subscription=n.subscribe({next:function(n){e.setDataWithCallback("list",n,function(){e.getData("list").forEach(function(n){var r=n.name,o=n.weight,u=n.multi;if(!e.getData("listForRendering").some(function(e){return e.name===r})){var a=e.getProp("uniqueKey")?[e.getProp("name"),e.getProp("uniqueKey")]:[e.getProp("name")];e.getProp("uniqueKey")&&!t.hasAppInstance.apply(t,[r].concat(a))&&t.instantiateApp.apply(t,[r].concat(a));var i=t.getAppInstance.apply(t,[r].concat(a));i&&e.sendProps(i,{name:e.getProp("name"),uniqueKey:e.getProp("uniqueKey"),data:e.getProp("data")}),e.setData("listForRendering",e.getData("listForRendering").concat({name:r,weight:o,instance:i,multi:u,Component:e.getMountableComponent(i)}).sort(function(e,t){return e.weight-t.weight}))}})})},error:function(t){console.warn('Subscription error for <Region name="'+e.name+'" />:',t)}})}},shouldUpdate:function(e,t){var n=!(0,u.default)(this.getProps(),e);if(!n){var r=t.listForRendering;n=n||this.getData("listForRendering").length!==r.length,n=n||(0,i.default)(this.getData("listForRendering"),r,function(e,t){return e.name===t.name}).some(function(e){return!e})}return n},afterUpdate:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=t||{},r=n.name,o=void 0===r?this.getProp("name"):r,u=n.uniqueKey,a=void 0===u?this.getProp("uniqueKey"):u,i=n.data,s=void 0===i?this.getProp("data"):i;this.getData("listForRendering").filter(function(e){return e.instance}).forEach(function(t){return e.sendProps(t.instance,{name:o,uniqueKey:a,data:s})})},beforeDestroy:function(){var e=this;this._subscription&&this._subscription.unsubscribe(),this.rootApp&&this.getData("listForRendering").filter(function(e){return e.multi}).forEach(function(t){e.rootApp.destroyApp(t.name,e.getProp("name"),e.getProp("uniqueKey"))})}},e.exports=t.default},function(e,t){e.exports=c},function(e,t){e.exports=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(27),o=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=o.default,e.exports=t.default},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(7),a=n(28),i=function(){function e(){r(this,e),this.props$=new u.BehaviorSubject({})}return o(e,[{key:"emit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.props$.next(e)}},{key:"getProps$",value:function(){return this.props$}},{key:"getData$",value:function(){var e;return(e=this.props$,a.map).call(e,function(e){return e.data})}}]),e}();t.default=i,e.exports=t.default},function(e,t){e.exports=f}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("prop-types"),require("rxjs/BehaviorSubject"),require("react-dom"),require("lodash/isPlainObject"),require("rxjs/observable/of"),require("rxjs/observable/merge"),require("rxjs/operators/concatMap"),require("rxjs/operators/scan"),require("lodash/isEqual"),require("lodash/zipWith"),require("rxjs/operators/map")):"function"==typeof define&&define.amd?define(["react","prop-types","rxjs/BehaviorSubject","react-dom","lodash/isPlainObject","rxjs/observable/of","rxjs/observable/merge","rxjs/operators/concatMap","rxjs/operators/scan","lodash/isEqual","lodash/zipWith","rxjs/operators/map"],t):"object"==typeof exports?exports.FrintReact=t(require("react"),require("prop-types"),require("rxjs/BehaviorSubject"),require("react-dom"),require("lodash/isPlainObject"),require("rxjs/observable/of"),require("rxjs/observable/merge"),require("rxjs/operators/concatMap"),require("rxjs/operators/scan"),require("lodash/isEqual"),require("lodash/zipWith"),require("rxjs/operators/map")):e.FrintReact=t(e.React,e.PropTypes,e.Rx,e.ReactDOM,e._.isPlainObject,e.Rx.Observable,e.Rx.Observable,e.Rx.operators,e.Rx.operators,e._.isEqual,e._.zipWith,e.Rx.operators)}(this,function(e,t,n,r,o,u,a,i,s,c,f,l){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=9)}([function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.get("component"),n={app:e},r=function(e){return a.default.createElement(s.default,n,a.default.createElement(t,e))};return function(e){return a.default.createElement(r,e)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var u=n(0),a=r(u),i=n(4),s=r(i);e.exports=t.default},function(e,n){e.exports=t},function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),u=function(e){return e&&e.__esModule?e:{default:e}}(o);t.default={setData:function(e,t){this.component.setState(r({},e,t))},setDataWithCallback:function(e,t,n){this.component.setState(r({},e,t),n)},getData:function(e){return this.component.state[e]},getProps:function(){return this.component.props},getProp:function(e){return this.component.props[e]},getMountableComponent:u.default},e.exports=t.default},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(0),s=n(2),c=function(e){return e&&e.__esModule?e:{default:e}}(s),f=function(e){function t(e,n){r(this,t);var u=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return u.app=e.app,u}return u(t,e),a(t,[{key:"getChildContext",value:function(){return{app:this.app}}}]),a(t,[{key:"render",value:function(){return i.Children.only(this.props.children)}}]),t}(i.Component);f.propTypes={app:c.default.object.isRequired,children:c.default.element.isRequired},f.childContextTypes={app:c.default.object.isRequired},t.default=f,e.exports=t.default},function(e,t,n){"use strict";function r(e){return!(!e||"function"!=typeof e.subscribe)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(5),o=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=o.default,e.exports=t.default},function(e,t){e.exports=n},function(e,t,n){"use strict";function r(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];[a.default].concat(n).forEach(function(t){Object.keys(t).forEach(function(n){e[n]=t[n],"function"==typeof t[n]&&(e[n]=e[n].bind(e))})})}function o(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return new(Function.prototype.bind.apply(r,[null].concat(t)))}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var u=n(20),a=function(e){return e&&e.__esModule?e:{default:e}}(u);e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(10),u=r(o),a=n(12),i=r(a),s=n(6),c=r(s),f=n(1),l=r(f),p=n(19),d=r(p),h=n(22),b=r(h),y=n(4),v=r(y),_=n(26),g=r(_),m=n(3),j=r(m);t.default={render:u.default,streamProps:i.default,isObservable:c.default,getMountableComponent:l.default,observe:d.default,Region:b.default,Provider:v.default,RegionService:g.default,ReactHandler:j.default},e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r=(0,s.default)(e);return n(11).render(a.default.createElement(r,null),t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var u=n(0),a=r(u),i=n(1),s=r(i);e.exports=t.default},function(e,t){e.exports=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(13),o=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=o.default,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new _(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();t.default=i;var f=n(14),l=r(f),p=n(15),d=n(16),h=n(17),b=n(18),y=n(5),v=r(y),_=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e),this._observables=[(0,p.of)(t)]}return c(e,[{key:"_push",value:function(e){this._observables.push(e)}},{key:"set",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return"string"==typeof e?this.setKey(e,n[0]):(0,l.default)(e)?this.setPlainObject(e):(0,v.default)(e)?this.setObservable.apply(this,[e].concat(n)):this}},{key:"setKey",value:function(e,t){return this._push((0,p.of)(u({},e,t))),this}},{key:"setPlainObject",value:function(e){return this._push((0,p.of)(e)),this}},{key:"setObservable",value:function(e){for(var t=e,n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.forEach(function(e){t=t.pipe((0,h.concatMap)(function(t){var n=e(t);return(0,v.default)(n)?n:(0,p.of)(n)}))}),this._push(t),this}},{key:"setDispatch",value:function(e,t){var n={};return Object.keys(e).forEach(function(r){var o=e[r];n[r]=function(){return t.dispatch(o.apply(void 0,arguments))}}),this._push((0,p.of)(n)),this}},{key:"get$",value:function(){return d.merge.apply(void 0,o(this._observables)).pipe((0,b.scan)(function(e,t){return s({},e,t)}))}}]),e}();e.exports=t.default},function(e,t){e.exports=o},function(e,t){e.exports=u},function(e,t){e.exports=a},function(e,t){e.exports=i},function(e,t){e.exports=s},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function i(e){return function(t){var n=function(n){function r(t,n){o(this,r);var a=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,t,n));a._props$=new h.BehaviorSubject(a.props);var i="function"==typeof e?e(n.app,a._props$):{};return(0,P.default)(i)?(a._handler=(0,y.default)(m.default,_.default,{component:a,getProps$:function(){return i}}),a.state=a._handler.getInitialData(),a):(a.state={computedProps:i},u(a))}return a(r,n),c(r,[{key:"componentWillMount",value:function(){this._handler&&(this._handler.app=this.context.app,this._handler.beforeMount())}},{key:"componentWillReceiveProps",value:function(e){this._handler&&this._props$.next(e)}},{key:"componentWillUnmount",value:function(){this._handler&&this._handler.beforeDestroy()}},{key:"render",value:function(){var e=this.state.computedProps;return l.default.createElement(t,s({},e,this.props))}}]),r}(l.default.Component);return n.displayName=void 0!==t.displayName?"observe("+t.displayName+")":"observe",n.contextTypes={app:d.default.object.isRequired},n}}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();t.default=i;var f=n(0),l=r(f),p=n(2),d=r(p),h=n(7),b=n(8),y=r(b),v=n(21),_=r(v),g=n(3),m=r(g),j=n(6),P=r(j);e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={app:null,component:null,initialize:function(){},beforeDestroy:function(){},getInitialData:function(){return{}},setData:function(e,t){},setDataWithCallback:function(e,t,n){this.setData(e,t),n()},getData:function(e){},getProp:function(e){},getProps:function(){},beforeMount:function(){},afterMount:function(){},beforeUpdate:function(){},shouldUpdate:function(e,t){},afterUpdate:function(){},getMountableComponent:function(e){return e.get("component")}},e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={getProps$:null,getInitialData:function(){return{computedProps:{}}},beforeMount:function(){var e=this;"function"==typeof this.getProps$&&(this._subscription=this.getProps$(this.app).subscribe(function(t){e.setData("computedProps",t)}))},beforeDestroy:function(){this._subscription&&this._subscription.unsubscribe()}},e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(0),c=r(s),f=n(2),l=r(f),p=n(8),d=r(p),h=n(23),b=r(h),y=n(3),v=r(y),_=function(e){function t(){var e;o(this,t);for(var n=arguments.length,r=Array(n),a=0;a<n;a++)r[a]=arguments[a];var i=u(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(r)));return i._handler=(0,d.default)(v.default,b.default,{component:i}),i.state=i._handler.getInitialData(),i}return a(t,e),i(t,[{key:"shouldComponentUpdate",value:function(e,t){return this._handler.shouldUpdate(e,t)}},{key:"componentWillMount",value:function(){this._handler.app=this.context.app,this._handler.beforeMount()}},{key:"componentWillReceiveProps",value:function(e){this._handler.afterUpdate(e)}},{key:"componentWillUnmount",value:function(){this._handler.beforeDestroy()}},{key:"render",value:function(){var e=this.state.listForRendering;return 0===e.length?null:c.default.createElement("div",null,e.map(function(e){var t=e.Component,n=e.name;return c.default.createElement(t,{key:"app-"+n})}))}}]),t}(c.default.Component);_.propTypes={name:l.default.string.isRequired,uniqueKey:l.default.string,data:l.default.any},_.contextTypes={app:l.default.object},t.default=_,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(24),u=r(o),a=n(25),i=r(a);t.default={getInitialData:function(){return{list:[],listForRendering:[]}},sendProps:function(e,t){var n=e.get(e.options.providerNames.region);n&&n.emit(t)},beforeMount:function(){var e=this,t=this.app?this.app.getRootApp():window.app;if(t){this.rootApp=t;var n=t.getApps$(this.getProp("name"),this.getProp("uniqueKey"));this._subscription=n.subscribe({next:function(n){e.setDataWithCallback("list",n,function(){e.getData("list").forEach(function(n){var r=n.name,o=n.weight,u=n.multi;if(!e.getData("listForRendering").some(function(e){return e.name===r})){var a=e.getProp("uniqueKey")?[e.getProp("name"),e.getProp("uniqueKey")]:[e.getProp("name")];e.getProp("uniqueKey")&&!t.hasAppInstance.apply(t,[r].concat(a))&&t.instantiateApp.apply(t,[r].concat(a));var i=t.getAppInstance.apply(t,[r].concat(a));i&&e.sendProps(i,{name:e.getProp("name"),uniqueKey:e.getProp("uniqueKey"),data:e.getProp("data")}),e.setData("listForRendering",e.getData("listForRendering").concat({name:r,weight:o,instance:i,multi:u,Component:e.getMountableComponent(i)}).sort(function(e,t){return e.weight-t.weight}))}})})},error:function(t){console.warn('Subscription error for <Region name="'+e.name+'" />:',t)}})}},shouldUpdate:function(e,t){var n=!(0,u.default)(this.getProps(),e);if(!n){var r=t.listForRendering;n=n||this.getData("listForRendering").length!==r.length,n=n||(0,i.default)(this.getData("listForRendering"),r,function(e,t){return e.name===t.name}).some(function(e){return!e})}return n},afterUpdate:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=t||{},r=n.name,o=void 0===r?this.getProp("name"):r,u=n.uniqueKey,a=void 0===u?this.getProp("uniqueKey"):u,i=n.data,s=void 0===i?this.getProp("data"):i;this.getData("listForRendering").filter(function(e){return e.instance}).forEach(function(t){return e.sendProps(t.instance,{name:o,uniqueKey:a,data:s})})},beforeDestroy:function(){var e=this;this._subscription&&this._subscription.unsubscribe(),this.rootApp&&this.getData("listForRendering").filter(function(e){return e.multi}).forEach(function(t){e.rootApp.destroyApp(t.name,e.getProp("name"),e.getProp("uniqueKey"))})}},e.exports=t.default},function(e,t){e.exports=c},function(e,t){e.exports=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(27),o=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=o.default,e.exports=t.default},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(7),a=n(28),i=function(){function e(){r(this,e),this.props$=new u.BehaviorSubject({})}return o(e,[{key:"emit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.props$.next(e)}},{key:"getProps$",value:function(){return this.props$}},{key:"getData$",value:function(){return this.props$.pipe((0,a.map)(function(e){return e.data}))}}]),e}();t.default=i,e.exports=t.default},function(e,t){e.exports=l}])}); |
@@ -15,5 +15,5 @@ 'use strict'; | ||
var _map = require('rxjs/operator/map'); | ||
var _map = require('rxjs/operators/map'); | ||
var _scan = require('rxjs/operator/scan'); | ||
var _scan = require('rxjs/operators/scan'); | ||
@@ -71,7 +71,5 @@ var _react = require('react'); | ||
var ObservedComponent = (0, _observe2.default)(function () { | ||
var _context; | ||
return (_context = (0, _of.of)(1), _map.map).call(_context, function (number) { | ||
return (0, _of.of)(1).pipe((0, _map.map)(function (number) { | ||
return { counter: number }; | ||
}); | ||
})); | ||
})(Component); | ||
@@ -128,9 +126,7 @@ | ||
var ObservedComponent = (0, _observe2.default)(function (app, props$) { | ||
var _context2; | ||
return (_context2 = (0, _merge.merge)((0, _of.of)({ name: app.getName() }), _map.map.call(props$, function (parentProps) { | ||
return (0, _merge.merge)((0, _of.of)({ name: app.getName() }), props$.pipe((0, _map.map)(function (parentProps) { | ||
return { parentProps: parentProps }; | ||
})), _scan.scan).call(_context2, function (props, emitted) { | ||
}))).pipe((0, _scan.scan)(function (props, emitted) { | ||
return _extends({}, props, emitted); | ||
}); | ||
})); | ||
})(Component); | ||
@@ -249,7 +245,5 @@ | ||
var ObservedComponent = (0, _observe2.default)(function (app) { | ||
var _context3; | ||
return (_context3 = (0, _of.of)(app.getName()), _map.map).call(_context3, function (name) { | ||
return (0, _of.of)(app.getName()).pipe((0, _map.map)(function (name) { | ||
return { name: name }; | ||
}); | ||
})); | ||
})(Component); | ||
@@ -256,0 +250,0 @@ |
@@ -103,3 +103,4 @@ 'use strict'; | ||
name: 'Alex', | ||
number: 6 }); | ||
number: 6 // 3 * 2 | ||
}); | ||
@@ -106,0 +107,0 @@ done(); |
{ | ||
"name": "frint-react", | ||
"version": "3.3.1", | ||
"version": "4.0.0", | ||
"description": "React package for Frint", | ||
@@ -31,12 +31,12 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"frint-component-handlers": "^3.3.1", | ||
"frint-component-utils": "^3.3.1", | ||
"frint-component-handlers": "^4.0.0", | ||
"frint-component-utils": "^4.0.0", | ||
"lodash": "^4.13.1", | ||
"rxjs": "^5.2.0" | ||
"rxjs": "^5.5.0" | ||
}, | ||
"devDependencies": { | ||
"cross-env": "^5.0.5", | ||
"frint": "^3.3.1", | ||
"frint-config": "^3.3.1", | ||
"frint-test-utils": "^3.3.1" | ||
"frint": "^4.0.0", | ||
"frint-config": "^4.0.0", | ||
"frint-test-utils": "^4.0.0" | ||
}, | ||
@@ -43,0 +43,0 @@ "bugs": { |
@@ -41,3 +41,3 @@ # frint-react | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/5.4.0/Rx.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/5.5.0/Rx.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.5.4/react.min.js"></script> | ||
@@ -264,9 +264,13 @@ <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.5.4/react-dom.min.js"></script> | ||
```js | ||
import { Observable } from 'rxjs'; | ||
import { interval } from 'rxjs/observable/interval'; | ||
import { map } from 'rxjs/operators/map'; | ||
import { observe } from 'frint-react'; | ||
const MyObservedComponent = observe(function () { | ||
return Observable | ||
.interval(1000) // emits an integer every 1 second | ||
.map(x => ({ interval: x })); // map the integer to a props-compatible object | ||
const interval$ = interval(1000); // emits an integer every 1 second | ||
return interval$ | ||
.pipe( | ||
map(x => ({ interval: x })) // map the integer to a props-compatible object | ||
); | ||
})(MyComponent); | ||
@@ -282,2 +286,6 @@ ``` | ||
```js | ||
import { map } from 'rxjs/operators/map'; | ||
import { merge } from 'rxjs/operators/merge'; | ||
import { scan } from 'rxjs/operators/scan'; | ||
const ObservedAppComponent = observe(function (app, props$) { | ||
@@ -288,9 +296,12 @@ // `app` is your App instance | ||
// let's keep our first interval Observable too | ||
const interval$ = Observable | ||
.interval(1000) | ||
.map(x => ({ interval: x })); | ||
const interval$ = interval(1000) | ||
.pipe( | ||
map(x => ({ interval: x })) | ||
); | ||
const region = app.get('region'); // the RegionService instance | ||
const regionData$ = region.getData$() | ||
.map(regionData => ({ regionData: regionData })); | ||
.pipe( | ||
map(regionData => ({ regionData: regionData })) | ||
); | ||
@@ -300,9 +311,11 @@ // now we have two observables, `interval$` and `regionData$`. | ||
return interval$ | ||
.merge(regionData$) | ||
.scan((props, emitted) => { | ||
return { | ||
...props, | ||
...emitted, | ||
}; | ||
}, {}); | ||
.pipe( | ||
merge(regionData$), | ||
scan((props, emitted) => { | ||
return { | ||
...props, | ||
...emitted, | ||
}; | ||
}, {}) | ||
); | ||
})(AppComponent); | ||
@@ -330,2 +343,3 @@ ``` | ||
```js | ||
import { interval } from 'rxjs/observable/interval'; | ||
import { streamProps } from 'frint-react'; | ||
@@ -337,3 +351,3 @@ | ||
.set( | ||
Observable.interval(1000), | ||
interval(1000), | ||
x => ({ interval: x }), | ||
@@ -340,0 +354,0 @@ ) |
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
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
126292
521
2270
+ Addedfrint-component-handlers@4.2.0(transitive)
+ Addedfrint-component-utils@4.2.0(transitive)
- Removedfrint-component-handlers@3.3.1(transitive)
- Removedfrint-component-utils@3.3.1(transitive)
Updatedfrint-component-utils@^4.0.0
Updatedrxjs@^5.5.0