Socket
Socket
Sign inDemoInstall

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.5 to 0.4.6

16

build/index.js

@@ -62,9 +62,13 @@ "use strict";

function on(target, listener) {
let free;
if (!target)
return;
else if (target[0])
else if (target[0]) {
target = target[0]; // box or selector or custom reactive
}
else {
[target, free] = reactive_box_1.sel(target);
}
let value;
const [get, free] = reactive_box_1.sel(target);
const [run, stop] = reactive_box_1.expr(get, () => {
const [run, stop] = reactive_box_1.expr(target, () => {
const prev = value;

@@ -74,3 +78,7 @@ listener((value = run()), prev);

value = run();
const unsub = () => (free(), stop());
const unsub = () => {
if (free)
free();
stop();
};
if (context_unsubs)

@@ -77,0 +85,0 @@ context_unsubs.push(unsub);

{
"name": "realar",
"version": "0.4.5",
"version": "0.4.6",
"description": "React state manager",

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

},
"gitHead": "fc67b18ffca5bb8ac391606b216ca4d8465aca2c"
"gitHead": "60c507b53010e2af3fa1e7ba307d7e8f608d3e2d"
}

@@ -31,3 +31,5 @@ import { useRef, useReducer, useEffect, useMemo, FC } from 'react';

function action<T = void>(init?: T): {
function action<T = void>(
init?: T
): {
(data?: T): void;

@@ -93,8 +95,14 @@ (): void;

) {
let free: (() => void) | undefined;
if (!target) return;
else if ((target as any)[0]) target = (target as any)[0]; // box or selector or custom reactive
else if ((target as any)[0]) {
target = (target as any)[0]; // box or selector or custom reactive
} else {
[target, free] = sel(target as any);
}
let value: T;
const [get, free] = sel(target as any);
const [run, stop] = expr(get, () => {
const [run, stop] = expr(target as any, () => {
const prev = value;

@@ -104,3 +112,6 @@ listener((value = run() as any), prev);

value = run() as any;
const unsub = () => (free(), stop());
const unsub = () => {
if (free) free();
stop();
};
if (context_unsubs) context_unsubs.push(unsub);

@@ -107,0 +118,0 @@ return unsub;

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