Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

realar

Package Overview
Dependencies
Maintainers
1
Versions
129
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

realar - npm Package Compare versions

Comparing version 0.4.15 to 0.4.16

6

package.json
{
"name": "realar",
"version": "0.4.15",
"version": "0.4.16",
"description": "React state manager",

@@ -30,3 +30,3 @@ "repository": {

"dependencies": {
"reactive-box": ">=0.5.7"
"reactive-box": "0.6.x"
},

@@ -89,3 +89,3 @@ "devDependencies": {

},
"gitHead": "672c0f53038190f26cf9bd36f253b5422c777a95"
"gitHead": "303d7ef2d61c1cf224017bb7992a034f414e9b35"
}

@@ -11,5 +11,5 @@ # Realar

Start!
Realar supported two kinds of data and logic definitions. One of them is [OOP](https://en.wikipedia.org/wiki/Object-oriented_programming).
You can start development with knows only two functions:
You can start development with classes and decorators knows only two functions:

@@ -68,6 +68,51 @@ `prop`. Reactive value marker. Each reactive value has an immutable state. If the immutable state will update, all React components that depend on It will refresh.

- [Intro](./docs/story.md) - story about `box`, `on`.
**box**
_Documentation not ready yet for `action`, `cache`, `on`, `sync`, `cycle`, `effect`, `shared`, `initial`, `mock`, `unmock`, `free`, `useLocal`, `observe`, `useValue`, `useShared`, `transaction`, `box`, `sel` functions. It's coming soon._
The first abstraction of Realar is reactive container - `box`.
The `box` is a place where your store some data as an immutable struct.
When you change box value (rewrite to a new immutable struct) all who depend on It will be updated synchronously.
For create new box we need `box` function from `realar`, and initial value that will store in reactive container.
The call of `box` function returns array of two functions.
- The first is value getter.
- The second one is necessary for save new value to reactive container.
```javascript
const [get, set] = box(0);
set(get() + 1);
console.log(get()); // 1
```
[Edit on RunKit](https://runkit.com/betula/6013af7649e8720019c9cf2a)
In that example
- for a first we created `box` container for number with initial zero;
- After that, we got the box value, and set to box its value plus one;
- Let's print the result to the developer console, that will is one.
We learned how to create a box, set, and get its value.
**on**
The next basic abstraction is expression.
Expression is a function that read reactive boxes or selectors. It can return value and write reactive boxes inside.
We can subscribe to change any reactive expression using `on` function.
```javascript
const [get, set] = box(0);
const next = () => get() + 1;
on(next, (val, prev) => console.log(val, prev));
set(5); // We will see 6, 1 in developer console output, It are new and previous value
```
[Edit on RunKit](https://runkit.com/betula/6013ea214e0cf9001ac18e71)
In that example expression is `next` function, because It get box value and return that plus one.
_Documentation not ready yet for `action`, `sel`, `shared`, `sync`, `cycle`, `effect`, `initial`, `mock`, `unmock`, `free`, `useLocal`, `useValue`, `useShared`, `observe`, `transaction`, `cache` functions. It's coming soon._
### Demos

@@ -87,3 +132,3 @@

And update your babel config for support decorators and using [babel plugin](https://github.com/betula/babel-plugin-realar) for automatic observation arrow function components.
And (if you like OOP) update your babel config for support decorators and using [babel plugin](https://github.com/betula/babel-plugin-realar) for automatic observation arrow function components.

@@ -90,0 +135,0 @@ ```javascript

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