Socket
Socket
Sign inDemoInstall

mobx

Package Overview
Dependencies
Maintainers
7
Versions
251
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mobx - npm Package Compare versions

Comparing version 6.0.0-rc.10 to 6.0.0

2

dist/core/action.d.ts
import { IDerivation } from "../internal";
export declare function createAction(actionName: string, fn: Function, autoAction?: boolean, ref?: Object): Function;
export declare function executeAction(actionName: string, canRunAsDeriviation: boolean, fn: Function, scope?: any, args?: IArguments): any;
export declare function executeAction(actionName: string, canRunAsDerivation: boolean, fn: Function, scope?: any, args?: IArguments): any;
export interface IActionRunInfo {

@@ -5,0 +5,0 @@ prevDerivation_: IDerivation | null;

{
"name": "mobx",
"version": "6.0.0-rc.10",
"version": "6.0.0",
"description": "Simple, scalable state management.",

@@ -143,2 +143,2 @@ "main": "dist/index.js",

}
}
}

@@ -1,15 +0,15 @@

<img src="assets/mobx.png" alt="logo" height="120" align="right" />
<img src="docs/assets/mobx.png" alt="logo" height="120" align="right" />
# MobX
_Simple, scalable state management_
_Simple, scalable state management._
[![Discuss on Github](https://img.shields.io/badge/discuss%20on-GitHub-orange)](https://github.com/mobxjs/mobx/discussions)
[![npm version](https://badge.fury.io/js/mobx.svg)](https://badge.fury.io/js/mobx)
[![OpenCollective](https://opencollective.com/mobx/backers/badge.svg)](#backers)
[![OpenCollective](https://opencollective.com/mobx/sponsors/badge.svg)](#sponsors)
[![OpenCollective](https://opencollective.com/mobx/backers/badge.svg)](docs/backers-sponsors.md#backers)
[![OpenCollective](https://opencollective.com/mobx/sponsors/badge.svg)](docs/backers-sponsors.md#sponsors)
---
MobX is made possible by the generosity of the sponsors below, and many [individual backers](http://mobxjs.github.io/mobx/backers-sponsors.html#backers). Sponsoring directly impacts the longevity of this project.
MobX is made possible by the generosity of the sponsors below, and many other [individual backers](docs/backers-sponsors.md#backers). Sponsoring directly impacts the longevity of this project.

@@ -42,3 +42,3 @@ **šŸ„‡Gold sponsors (\$3000+ total contribution):** <br/>

_Anything that can be derived from the application state, should be derived. Automatically._
_Anything that can be derived from the application state, should be. Automatically._

@@ -53,6 +53,5 @@ MobX is a battle tested library that makes state management simple and scalable by transparently applying functional reactive programming (TFRP).

<h5>Straightforward</h5>
<p>With MobX, you write minimalistic, boilerplate free code that captures your intent:
Trying to update a record field? Use good old JavaScript assignment.
Updating data in an asynchronous process? No special tools are required.
The reactivity system will detect all your changes and propagate them out to where they are being used.
<p>Write minimalistic, boilerplate free code that captures your intent.
Trying to update a record field? Use the good old JavaScript assignment.
Updating data in an asynchronous process? No special tools are required, the reactivity system will detect all your changes and propagate them out to where they are being used.
</p>

@@ -66,5 +65,5 @@ </div>

<p>
MobX tracks all updates and usages of your data at runtime, building a dependency tree that captures all relations between state and output.
All changes to and uses of your data are tracked at runtime, building a dependency tree that captures all relations between state and output.
This guarantees that computations depending on your state, like React components, run only when strictly needed.
With MobX, there is no need to manually optimize components using error-prone and sub-optimal techniques like memoization and selectors.
There is no need to manually optimize components with error-prone and sub-optimal techniques like memoization and selectors.
</p>

@@ -95,3 +94,3 @@ </div>

// Model the application state
// Model the application state.
class Timer {

@@ -104,7 +103,7 @@ secondsPassed = 0

increaseTimer() {
increase() {
this.secondsPassed += 1
}
resetTimer() {
reset() {
this.secondsPassed = 0

@@ -116,5 +115,5 @@ }

// Build a user interface for this app, that merely uses the state...
// Build a "user interface" that uses the observable state.
const TimerView = observer(({ timer }) => (
<button onClick={() => timer.resetTimer()}>Seconds passed: {timer.secondsPassed}</button>
<button onClick={() => timer.reset()}>Seconds passed: {timer.secondsPassed}</button>
))

@@ -124,21 +123,23 @@

// For demo's sake, let's force some updates...
// Update the 'Seconds passed: X' text every second.
setInterval(() => {
myTimer.increaseTimer()
myTimer.increase()
}, 1000)
```
The `observer` wrapper around the `TimerView` React component will automatically detect that rendering
of the component depends on `timer.secondsPassed`, even though this relationship is not explicitly defined. MobX's reactivity system will make sure the component gets re-rendered when _precisely that_ field is updated in the future.
The `observer` wrapper around the `TimerView` React component, will automatically detect that rendering
depends on the `timer.secondsPassed` observable, even though this relationship is not explicitly defined. The reactivity system will take care of re-rendering the component when _precisely that_ field is updated in the future.
Every event (`onClick` and `setInterval`) invokes an _action_ (`increaseTimer` and `resetTimer` functions) that updates _observable state_ (`secondsPassed` class property).
Changes in the observable state are propagated precisely to all _computations_ and _side-effects_ (`TimerView` component) that depend on the changes being made.
Every event (`onClick` / `setInterval`) invokes an _action_ (`myTimer.increase` / `myTimer.reset`) that updates _observable state_ (`myTimer.secondsPassed`).
Changes in the observable state are propagated precisely to all _computations_ and _side effects_ (`TimerView`) that depend on the changes being made.
<img alt="MobX unidirectional flow" src="docs/assets/flow2.png" align="center" />
You can apply this diagram as a conceptual picture to this simple example or any other application using MobX.
This conceptual picture can be applied to the above example, or any other application using MobX.
To learn about the core concepts of MobX with a larger example, please read [Concepts & Principles](http://mobxjs.github.io/mobx/intro/concepts.html) or take the [10 minute interactive introduction to MobX and React](https://mobx.js.org/getting-started).
The philosophy and benefits of the mental model provided by MobX are described in detail in the blogs [UI as an afterthought](https://michel.codes/blogs/ui-as-an-afterthought) and [How to decouple state and UI (a.k.a. you donā€™t need componentWillMount)](https://hackernoon.com/how-to-decouple-state-and-ui-a-k-a-you-dont-need-componentwillmount-cc90b787aa37).
To learn about the core concepts of MobX using a larger example, check out [The gist of MobX](docs/the-gist-of-mobx.md) section, or take the [10 minute interactive introduction to MobX and React](https://mobx.js.org/getting-started).
The philosophy and benefits of the mental model provided by MobX are also described in great detail in the blog posts [UI as an afterthought](https://michel.codes/blogs/ui-as-an-afterthought) and [How to decouple state and UI (a.k.a. you donā€™t need componentWillMount)](https://hackernoon.com/how-to-decouple-state-and-ui-a-k-a-you-dont-need-componentwillmount-cc90b787aa37).
<div class="cheat"><a href="https://gum.co/fSocU"><button title="Download the MobX 6 cheat sheet and sponsor the project">Download the MobX 6 cheat sheet</button></a></div>
## What others are saying...

@@ -158,17 +159,28 @@

- [Ten minute, interactive MobX + React tutorial](https://mobx.js.org/getting-started)
- <i><a style="color: white; background:green;padding:5px;margin:5px;border-radius:2px" href="https://egghead.io/courses/manage-complex-state-in-react-apps-with-mobx">egghead.io course</a></i> (Based on MobX 3)
- <img src="docs/assets/book.jpg" height="80px"/> [The MobX book](https://books.google.nl/books?id=ALFmDwAAQBAJ&pg=PP1&lpg=PP1&dq=michel+weststrate+mobx+quick+start+guide:+supercharge+the+client+state+in+your+react+apps+with+mobx&source=bl&ots=D460fxti0F&sig=ivDGTxsPNwlOjLHrpKF1nweZFl8&hl=nl&sa=X&ved=2ahUKEwiwl8XO--ncAhWPmbQKHWOYBqIQ6AEwAnoECAkQAQ#v=onepage&q=michel%20weststrate%20mobx%20quick%20start%20guide%3A%20supercharge%20the%20client%20state%20in%20your%20react%20apps%20with%20mobx&f=false) by Pavan Podila and Michel Weststrate.
- Videos:
- [Introduction to MobX & React in 2020](https://www.youtube.com/watch?v=pnhIJA64ByY) - 17m by Leigh Halliday.
- [ReactNext 2016: Real World MobX](https://www.youtube.com/watch?v=Aws40KOx90U) - 40m [slides](https://docs.google.com/presentation/d/1DrI6Hc2xIPTLBkfNH8YczOcPXQTOaCIcDESdyVfG_bE/edit?usp=sharing)
- [Practical React with MobX](https://www.youtube.com/watch?v=XGwuM_u7UeQ). In depth introduction and explanation to MobX and React by Matt Ruby on OpenSourceNorth (ES5 only) - 42m.
- [MobX and the unique symbiosis of predictability and speed](https://www.youtube.com/watch?v=NBYbBbjZeX4&list=PL8sJahqnzh8JJD7xahG5zXkjfM5GOgcPA&index=21&t=0s) - HolyJS 2019 conf, 59 min
- [Talk: State Management Is Easy, React Amsterdam 2016 conf](https://www.youtube.com/watch?v=ApmSsu3qnf0&feature=youtu.be) ([slides](https://speakerdeck.com/mweststrate/state-management-is-easy-introduction-to-mobx))
- [MobX awesome list](https://github.com/mobxjs/awesome-mobx#awesome-mobx)
- [MobX cheat sheet (also sponsors the project)](https://gum.co/fSocU)
- [10 minute interactive introduction to MobX and React](https://mobx.js.org/getting-started)
- [Egghead.io course, based on MobX 3](https://egghead.io/courses/manage-complex-state-in-react-apps-with-mobx)
### The MobX book
[<img src="docs/assets/book.jpg" height="80px"/> ](https://books.google.nl/books?id=ALFmDwAAQBAJ&pg=PP1&lpg=PP1&dq=michel+weststrate+mobx+quick+start+guide:+supercharge+the+client+state+in+your+react+apps+with+mobx&source=bl&ots=D460fxti0F&sig=ivDGTxsPNwlOjLHrpKF1nweZFl8&hl=nl&sa=X&ved=2ahUKEwiwl8XO--ncAhWPmbQKHWOYBqIQ6AEwAnoECAkQAQ#v=onepage&q=michel%20weststrate%20mobx%20quick%20start%20guide%3A%20supercharge%20the%20client%20state%20in%20your%20react%20apps%20with%20mobx&f=false)
Created by [Pavan Podila](https://twitter.com/pavanpodila) and [Michel Weststrate](https://twitter.com/mweststrate).
### Videos
- [Introduction to MobX & React in 2020](https://www.youtube.com/watch?v=pnhIJA64ByY) by Leigh Halliday, _17min_.
- [ReactNext 2016: Real World MobX](https://www.youtube.com/watch?v=Aws40KOx90U) by Michel Weststrate, _40min_, [slides](https://docs.google.com/presentation/d/1DrI6Hc2xIPTLBkfNH8YczOcPXQTOaCIcDESdyVfG_bE/edit?usp=sharing).
- [CityJS 2020: MobX, from mutable to immutable, to observable data](https://youtu.be/sP7dtZm_Wx0?t=27050) by Michel Weststrate, _30min_
- [OpenSourceNorth: Practical React with MobX (ES5)](https://www.youtube.com/watch?v=XGwuM_u7UeQ) by Matt Ruby, _42min_.
- [HolyJS 2019: MobX and the unique symbiosis of predictability and speed](https://www.youtube.com/watch?v=NBYbBbjZeX4&list=PL8sJahqnzh8JJD7xahG5zXkjfM5GOgcPA&index=21&t=0s) by Michel Weststrate, _59min_.
- [React Amsterdam 2016: State Management Is Easy](https://www.youtube.com/watch?v=ApmSsu3qnf0&feature=youtu.be) by Michel Weststrate, _20min_, [slides](https://speakerdeck.com/mweststrate/state-management-is-easy-introduction-to-mobx).
- {šŸš€} [React Live 2019: Reinventing MobX](https://www.youtube.com/watch?v=P_WqKZxpX8g) by Max Gallo, _27min_.
And an all around [MobX awesome list](https://github.com/mobxjs/awesome-mobx#awesome-mobx).
## Credits
MobX is inspired by reactive programming principles as found in spreadsheets. It is inspired by MVVM frameworks like in MeteorJS tracker, knockout and Vue.js. But MobX brings Transparent Functional Reactive Programming to the next level and provides a stand alone implementation. It implements TFRP in a glitch-free, synchronous, predictable and efficient manner.
MobX is inspired by reactive programming principles as found in the spreadsheets. It is inspired by MVVM frameworks like MeteorJS tracker, knockout and Vue.js, but MobX brings _Transparent Functional Reactive Programming_ to the next level and provides a standalone implementation. It implements TFRP in a glitch-free, synchronous, predictable and efficient manner.
A ton of credits for [Mendix](https://github.com/mendix), for providing the flexibility and support to maintain MobX and the chance to proof the philosophy of MobX in a real, complex, performance critical applications.
A ton of credits goes to [Mendix](https://github.com/mendix), for providing the flexibility and support to maintain MobX and the chance to proof the philosophy of MobX in a real, complex, performance critical applications.

@@ -58,3 +58,3 @@ import {

actionName: string,
canRunAsDeriviation: boolean,
canRunAsDerivation: boolean,
fn: Function,

@@ -64,3 +64,3 @@ scope?: any,

) {
const runInfo = _startAction(actionName, canRunAsDeriviation, scope, args)
const runInfo = _startAction(actionName, canRunAsDerivation, scope, args)
try {

@@ -67,0 +67,0 @@ return fn.apply(scope, args)

Sorry, the diff of this file is too big to display

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 too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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