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.5.4 to 0.5.5

1

build/index.d.ts

@@ -19,2 +19,3 @@ import { FC } from 'react';

val: T;
update: (fn: (state: T) => T) => void;
} & [() => T, (value: T) => void];

@@ -21,0 +22,0 @@ declare type Signal<T, K = T> = Callable<T> & Pick<Promise<T>, 'then' | 'catch' | 'finally'> & {

@@ -50,2 +50,3 @@ "use strict";

set[1] = set;
set.update = (fn) => set(fn(get()));
Object.defineProperty(set, key, { get, set });

@@ -52,0 +53,0 @@ return set;

4

package.json
{
"name": "realar",
"version": "0.5.4",
"version": "0.5.5",
"description": "React state manager",

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

},
"gitHead": "c2aa51e896001bf839ceab1dfbea45dc1358b324"
"gitHead": "1bc86ad91ea434b8fb12339a4a331041603a0a06"
}

@@ -348,2 +348,49 @@ # Realar

**selector**
Necessary for making high-cost calculations and cache them for many times of accessing without changing source dependencies. And for downgrade (selection from) your hierarchical store.
```javascript
const store = value({
address: {
city: 'NY'
}
});
const address = selector(() => store.val.address);
on(address, ({ city }) => console.log(city)); // Subscribe to address selector
console.log(address.val.city); // Write current value of address selector
store.update(state => ({
...state,
user: {}
}));
// Store changed but non reaction from address selector
store.update(state => ({
...state,
address: {
city: 'LA'
}
}));
// We can see reaction on deleveloper console output with new address selector value
```
[Edit on RunKit](https://runkit.com/betula/60338ff8dbe368001a10be8c)
**cache**
`cache` - is the decorator for define `selector` on class getter.
```javascript
class Todos {
@prop items = [];
@cache get completed() {
return this.items.filter(item => item.completed);
}
}
```
**cycle**

@@ -384,3 +431,3 @@

_Documentation not ready yet for `selector`, `effect`, `initial`, `mock`, `unmock`, `free`, `cache`, `observe`, `transaction`, `untrack` functions. It's coming soon._
_Documentation not ready yet for `effect`, `initial`, `mock`, `unmock`, `free`, `transaction`, `untrack` functions. It's coming soon._

@@ -387,0 +434,0 @@ ### Demos

@@ -89,2 +89,3 @@ import React, { Context, FC } from 'react';

val: T;
update: (fn: (state: T) => T) => void;
} & [() => T, (value: T) => void];

@@ -112,2 +113,4 @@

set.update = (fn: any) => set(fn(get()));
Object.defineProperty(set, key, { get, set });

@@ -114,0 +117,0 @@ return set;

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