New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

microcosm

Package Overview
Dependencies
Maintainers
4
Versions
233
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

microcosm - npm Package Compare versions

Comparing version 12.13.0-alpha.0 to 12.13.0-alpha.1

31

addons/presenter.js

@@ -10,27 +10,2 @@ 'use strict';

/**
* Diffing algorithm for presenters. We need to recalculate the
* model of props are state change, but ignore children.
*/
function shallowDiff(a, b) {
for (var key in a) {
if (key === 'children') {
continue
}
if (a[key] !== b[key]) {
return true
}
}
for (var key$1 in b) {
if (!(key$1 in a)) {
return true
}
}
return false
}
// Cross platform request animation frame

@@ -124,6 +99,4 @@

Presenter.prototype.componentWillUpdate = function componentWillUpdate (props , state ) {
if (shallowDiff(this.props, props) || shallowDiff(this.state, state)) {
this._updateModel(props, state);
this.update(this.repo, props, state);
}
this._updateModel(props, state);
this.update(this.repo, props, state);
};

@@ -130,0 +103,0 @@

@@ -5,27 +5,2 @@ import React from 'react';

/**
* Diffing algorithm for presenters. We need to recalculate the
* model of props are state change, but ignore children.
*/
function shallowDiff(a, b) {
for (var key in a) {
if (key === 'children') {
continue
}
if (a[key] !== b[key]) {
return true
}
}
for (var key$1 in b) {
if (!(key$1 in a)) {
return true
}
}
return false
}
// Cross platform request animation frame

@@ -119,6 +94,4 @@

Presenter.prototype.componentWillUpdate = function componentWillUpdate (props , state ) {
if (shallowDiff(this.props, props) || shallowDiff(this.state, state)) {
this._updateModel(props, state);
this.update(this.repo, props, state);
}
this._updateModel(props, state);
this.update(this.repo, props, state);
};

@@ -125,0 +98,0 @@

2

min/addons/presenter.js

@@ -1,2 +0,2 @@

"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}function e(t,e){for(var r in t)if("children"!==r&&t[r]!==e[r])return!0;for(var o in e)if(!(o in t))return!0;return!1}function r(){return this.props.children?n.Children.only(this.props.children):null}function o(){return n.createElement(l,{presenter:this,presenterProps:this.props,presenterState:this.state})}var n=t(require("react")),i=require("../microcosm.js"),s=t(i),p=t(require("./model.js")),h="undefined"!=typeof requestAnimationFrame,u=setTimeout,d=clearTimeout;h&&(u=requestAnimationFrame,d=cancelAnimationFrame);var a=function(){},c=function(t){function n(e,n){t.call(this),this.render?this.defaultRender=this.render:this.defaultRender=r,this.render=o,this.send=this.send.bind(this),this.state={}}t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n;var i={model:{}};return i.model.get=function(){return this.mediator.model.value},n.prototype.setup=function(t,e,r){},n.prototype.ready=function(t,e,r){},n.prototype.componentWillUpdate=function(t,r){(e(this.props,t)||e(this.state,r))&&(this.e(t,r),this.update(this.repo,t,r))},n.prototype.update=function(t,e,r){},n.prototype.teardown=function(t,e,r){},n.prototype.intercept=function(){return null},n.prototype.getRepo=function(t,e){return t?t.fork():new s},n.prototype.send=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];return(o=this.mediator).send.apply(o,[t].concat(e));var o},n.prototype.getModel=function(t,e){return{}},n.prototype.e=function(t,e){return this.mediator.model.bind(this.getModel(t,e))},n.prototype.r=function(t){this.repo=t.repo,this.mediator=t,this.setup(this.repo,this.props,this.state),this.e(this.props,this.state),this.ready(this.repo,this.props,this.state)},n.prototype.o=function(){this.teardown(this.repo,this.props,this.state)},n.prototype.n=function(t){var e=this.props.repo||t,r=this.getRepo(e,this.props);return this.didFork=r!==e,r},Object.defineProperties(n.prototype,i),n}(n.PureComponent),l=function(t){function e(e,r){t.call(this,e,r),this.presenter=e.presenter,this.repo=this.presenter.n(r.repo),this.i=-1/0,this.model=new p(this.repo,this.presenter),this.send=this.send.bind(this),this.s=this.s.bind(this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getChildContext=function(){return{repo:this.repo,send:this.send,parent:this}},e.prototype.componentWillMount=function(){this.presenter.r(this)},e.prototype.componentDidMount=function(){this.presenter.refs=this.refs,this.model.on("change",this.p,this)},e.prototype.componentWillUnmount=function(){this.presenter.refs=this.refs,this.presenter.didFork&&this.repo.shutdown(),this.model.teardown(),this.presenter.o(),this.h()},e.prototype.render=function(){var t=this.presenter,e=t.model,r=t.view,o=this.props.presenterProps;return this.i=this.model.revision,null!=r?n.createElement(r,i.merge(o,{repo:this.repo,send:this.send},e)):this.presenter.defaultRender()},e.prototype.send=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var o=i.tag(t),n=this;n;){var s=n.u(o);if(s)return s.call.apply(s,[n.presenter,n.repo].concat(e));n=n.d()}return(p=this.repo).push.apply(p,arguments);var p},e.prototype.s=function(){this.model.revision>this.i&&this.forceUpdate(),this.a=null},e.prototype.p=function(){this.repo.history.batch?this.a||(this.a=u(this.s)):this.forceUpdate()},e.prototype.h=function(){this.a&&(d(this.a),this.a=null)},e.prototype.d=function(){return this.context.parent},e.prototype.u=function(t){var e=this.presenter.intercept();return i.getRegistration(e,t,"resolve")[0]},e}(n.PureComponent);l.contextTypes={repo:a,send:a,parent:a},l.childContextTypes={repo:a,send:a,parent:a},module.exports=c;
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}function e(){return this.props.children?o.Children.only(this.props.children):null}function r(){return o.createElement(c,{presenter:this,presenterProps:this.props,presenterState:this.state})}var o=t(require("react")),n=require("../microcosm.js"),s=t(n),i=t(require("./model.js")),p="undefined"!=typeof requestAnimationFrame,h=setTimeout,u=clearTimeout;p&&(h=requestAnimationFrame,u=cancelAnimationFrame);var d=function(){},a=function(t){function o(o,n){t.call(this),this.render?this.defaultRender=this.render:this.defaultRender=e,this.render=r,this.send=this.send.bind(this),this.state={}}t&&(o.__proto__=t),o.prototype=Object.create(t&&t.prototype),o.prototype.constructor=o;var n={model:{}};return n.model.get=function(){return this.mediator.model.value},o.prototype.setup=function(t,e,r){},o.prototype.ready=function(t,e,r){},o.prototype.componentWillUpdate=function(t,e){this.e(t,e),this.update(this.repo,t,e)},o.prototype.update=function(t,e,r){},o.prototype.teardown=function(t,e,r){},o.prototype.intercept=function(){return null},o.prototype.getRepo=function(t,e){return t?t.fork():new s},o.prototype.send=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];return(o=this.mediator).send.apply(o,[t].concat(e));var o},o.prototype.getModel=function(t,e){return{}},o.prototype.e=function(t,e){return this.mediator.model.bind(this.getModel(t,e))},o.prototype.r=function(t){this.repo=t.repo,this.mediator=t,this.setup(this.repo,this.props,this.state),this.e(this.props,this.state),this.ready(this.repo,this.props,this.state)},o.prototype.o=function(){this.teardown(this.repo,this.props,this.state)},o.prototype.n=function(t){var e=this.props.repo||t,r=this.getRepo(e,this.props);return this.didFork=r!==e,r},Object.defineProperties(o.prototype,n),o}(o.PureComponent),c=function(t){function e(e,r){t.call(this,e,r),this.presenter=e.presenter,this.repo=this.presenter.n(r.repo),this.s=-1/0,this.model=new i(this.repo,this.presenter),this.send=this.send.bind(this),this.i=this.i.bind(this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getChildContext=function(){return{repo:this.repo,send:this.send,parent:this}},e.prototype.componentWillMount=function(){this.presenter.r(this)},e.prototype.componentDidMount=function(){this.presenter.refs=this.refs,this.model.on("change",this.p,this)},e.prototype.componentWillUnmount=function(){this.presenter.refs=this.refs,this.presenter.didFork&&this.repo.shutdown(),this.model.teardown(),this.presenter.o(),this.h()},e.prototype.render=function(){var t=this.presenter,e=t.model,r=t.view,s=this.props.presenterProps;return this.s=this.model.revision,null!=r?o.createElement(r,n.merge(s,{repo:this.repo,send:this.send},e)):this.presenter.defaultRender()},e.prototype.send=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var o=n.tag(t),s=this;s;){var i=s.u(o);if(i)return i.call.apply(i,[s.presenter,s.repo].concat(e));s=s.d()}return(p=this.repo).push.apply(p,arguments);var p},e.prototype.i=function(){this.model.revision>this.s&&this.forceUpdate(),this.a=null},e.prototype.p=function(){this.repo.history.batch?this.a||(this.a=h(this.i)):this.forceUpdate()},e.prototype.h=function(){this.a&&(u(this.a),this.a=null)},e.prototype.d=function(){return this.context.parent},e.prototype.u=function(t){var e=this.presenter.intercept();return n.getRegistration(e,t,"resolve")[0]},e}(o.PureComponent);c.contextTypes={repo:d,send:d,parent:d},c.childContextTypes={repo:d,send:d,parent:d},module.exports=a;
//# sourceMappingURL=presenter.js.map
{
"name": "microcosm",
"version": "12.13.0-alpha.0",
"version": "12.13.0-alpha.1",
"description": "Flux with actions at center stage. Write optimistic updates, cancel requests, and track changes with ease.",

@@ -5,0 +5,0 @@ "main": "microcosm.js",

@@ -10,27 +10,2 @@ 'use strict';

/**
* Diffing algorithm for presenters. We need to recalculate the
* model of props are state change, but ignore children.
*/
function shallowDiff(a, b) {
for (var key in a) {
if (key === 'children') {
continue
}
if (a[key] !== b[key]) {
return true
}
}
for (var key$1 in b) {
if (!(key$1 in a)) {
return true
}
}
return false
}
// Cross platform request animation frame

@@ -124,6 +99,4 @@

Presenter.prototype.componentWillUpdate = function componentWillUpdate (props , state ) {
if (shallowDiff(this.props, props) || shallowDiff(this.state, state)) {
this._updateModel(props, state);
this.update(this.repo, props, state);
}
this._updateModel(props, state);
this.update(this.repo, props, state);
};

@@ -130,0 +103,0 @@

{
"name": "microcosm",
"version": "12.13.0-alpha.0",
"version": "12.13.0-alpha.1",
"description": "Flux with actions at center stage. Write optimistic updates, cancel requests, and track changes with ease.",

@@ -5,0 +5,0 @@ "main": "microcosm.js",

@@ -11,27 +11,2 @@ (function (global, factory) {

/**
* Diffing algorithm for presenters. We need to recalculate the
* model of props are state change, but ignore children.
*/
function shallowDiff(a, b) {
for (var key in a) {
if (key === 'children') {
continue
}
if (a[key] !== b[key]) {
return true
}
}
for (var key$1 in b) {
if (!(key$1 in a)) {
return true
}
}
return false
}
// Cross platform request animation frame

@@ -125,6 +100,4 @@

Presenter.prototype.componentWillUpdate = function componentWillUpdate (props , state ) {
if (shallowDiff(this.props, props) || shallowDiff(this.state, state)) {
this._updateModel(props, state);
this.update(this.repo, props, state);
}
this._updateModel(props, state);
this.update(this.repo, props, state);
};

@@ -131,0 +104,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc