From 7fd183004abea369e2f3d70f909f515e3447b0ca Mon Sep 17 00:00:00 2001 From: Leonardo Gentile Date: Wed, 18 Apr 2018 12:55:26 +0200 Subject: [PATCH] docs(README): Update docs --- README.md | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index d50c38e..6392dac 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This plugin can also be used standalone together with mobx. ## Requirements - __router5 >= 5.0.0__ -- __mobx >= 3.1.0__ +- __mobx >= 4.0.0__ These are considered `peerDependencies` that means they should exist in your installation, you should install them yourself to make this plugin work. The package won't install them as dependencies. @@ -26,16 +26,18 @@ npm install mobx-router5 ## How it works Before using this plugin it is necessary that you understand how [router5 works](http://router5.github.io/docs/understanding-router5.html). -Whenever you performs a router5's transition from one state to another and that transition is *started*, *canceled*, it's *successful* or it has a transition *error* this plugin exposes all this info as [mobx observables](https://mobx.js.org/refguide/observable.html) properties of the `RouterStore` class. You can then use the mobx API to **observe** and react to these **observables**: +Whenever you performs a router5's transition from one state to another and that transition is *started*, *canceled*, it's *successful* or it has a transition *error* +this plugin exposes all this info as [mobx observables references](https://mobx.js.org/refguide/observable.html) properties of the `RouterStore` class. +You can then use the mobx API to **observe** and react to these **observables**: ```javascript -@observable route // the current route -@observable previousRoute -@observable transitionRoute -@observable transitionError -@observable intersectionNode -@observable canActivate -@observable canDeactivate +@observable.ref route; // Current Route - Object +@observable.ref previousRoute; // Object +@observable.ref transitionRoute; // Object +@observable.ref transitionError; // Object +@observable.ref intersectionNode; // String +@observable.ref canActivate; // Array +@observable.ref canDeactivate; // Array ``` @@ -98,20 +100,6 @@ Normally it's **not necessary** to *manually* call these actions, the plugin wil The only one probably worth calling manually (only when necessary) is `clearErrors()`: it resets the `transitionRoute` and `transitionError`. -These actions ensures that these observables properties of the store are always up-to-date with the current state: - -```javascript -@observable route; // Object -@observable previousRoute; // Object -@observable transitionRoute; // Object -@observable transitionError; // Object -@observable intersectionNode; // String -@observable canActivate; // Array -@observable canDeactivate; // Array - -``` - - ### Router instance reference inside the store When you add the plugin to the router with