Comparing version 0.4.19 to 0.4.20
{ | ||
"name": "realar", | ||
"version": "0.4.19", | ||
"version": "0.4.20", | ||
"description": "React state manager", | ||
@@ -88,3 +88,3 @@ "repository": { | ||
}, | ||
"gitHead": "72effd67f8285c74f0ddddfc4e493d3f753219d8" | ||
"gitHead": "958eb52b7f338aa7a0ce79b7e8bbabd498e5dd0d" | ||
} |
@@ -9,12 +9,50 @@ # Realar | ||
Realar targeted to clean code, minimal abstraction, minimal additional functions, modulable architecture, and time of delivery user experience. | ||
Realar targeted to clean code, modulable architecture, and time of delivery user experience. | ||
Realar supported two kinds of data and logic definitions. | ||
Supported **two kinds** of data and logic definitions. | ||
> If you don't have an interest in classes or decorators, you can code in [functional style](#functional-usage) with a wide and full feature API. | ||
- Plain functional reactive programming with only functions | ||
But if you like, it looks likes very clear and natively, and you can start development knows only two functions. | ||
```javascript | ||
const [getCount, set] = box(0); | ||
const tick = () => set(getCount() + 1); | ||
setInterval(tick, 200); | ||
const App = () => { | ||
const count = useValue(getCount); | ||
return ( | ||
<p>{count}</p> | ||
) | ||
} | ||
``` | ||
[Try on CodeSandbox](https://codesandbox.io/s/realar-ticker-functional-6s3mx?file=/src/App.tsx) | ||
- And transparent functional reactive programming with classes, decorators and [jsx wrapper](https://github.com/betula/babel-plugin-realar) | ||
```javascript | ||
class Ticker { | ||
@prop count = 0 | ||
tick = () => ++this.count; | ||
} | ||
const ticker = new Ticker(); | ||
setInterval(ticker.tick, 200); | ||
const App = () => ( | ||
<p>{ticker.count}</p> | ||
) | ||
``` | ||
[Try wrapped version on CodeSandbox](https://codesandbox.io/s/realar-ticker-classes-c9819?file=/src/App.tsx) | ||
Realar **targeted to** all scale applications up to complex enterprise solutions on microfrontends architecture. | ||
You can use as many from Realar as you want. For small websites or theme switchers, two functions are enough:ok_hand: Step by step on the applications scale stairs you can take more and more. From sharing state to all application parts, to modulable architecture with apps composition. | ||
### Classes usage | ||
If you don't have an interest in classes or decorators, you can code in [functional style](#functional-usage) with a wide and full feature API. | ||
But if you like, it looks likes very clear and natively, and you can start development knows only two functions. | ||
`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. | ||
@@ -77,2 +115,3 @@ | ||
const next = () => get() + 1; | ||
const inc = () => set(next()); | ||
@@ -167,4 +206,5 @@ const dec = () => set(get() - 1); | ||
// In output of developer console will be 2, 3 and 4. | ||
// In output of developer console will be 1, 2 and 3. | ||
``` | ||
[Edit on RunKit](https://runkit.com/betula/601a733c5bfc4e001a38def8) | ||
@@ -175,4 +215,19 @@ - Takes a function as reactive expression. | ||
_Documentation not ready yet for `on`, `action`, `sel`, `shared`, `sync`, `cycle`, `effect`, `initial`, `mock`, `unmock`, `free`, `useLocal`, `useValue`, `useShared`, `useScoped`, `Scope`, `observe`, `transaction`, `cache` functions. It's coming soon._ | ||
**sync** | ||
```javascript | ||
const [getSource, setSource] = box(0); | ||
const [getTarget, setTarget] = box(0); | ||
sync(getSource, setTarget); | ||
// same as sync(() => getSource(), val => setTarget(val)); | ||
setSource(10); | ||
console.log(getTarget()) // 10 | ||
``` | ||
[Edit on RunKit](https://runkit.com/betula/601a73b26adfe70020a0e229) | ||
_Documentation not ready yet for `action`, `sel`, `shared`, `effect`, `initial`, `mock`, `unmock`, `free`, `useLocal`, `useValue`, `useShared`, `useScoped`, `Scope`, `observe`, `transaction`, `cache`, `prop` functions. It's coming soon._ | ||
### Demos | ||
@@ -192,3 +247,3 @@ | ||
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. | ||
**If you like OOP** update your babel config for support class decorators and using [babel plugin](https://github.com/betula/babel-plugin-realar) for automatic observation arrow function components. | ||
@@ -195,0 +250,0 @@ ```javascript |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38053
263