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.10 to 0.4.11

31

build/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.transaction = exports.expr = exports.sel = exports.box = exports.mock = exports.free = exports.useShared = exports.useLocal = exports.useValue = exports.observe = exports.initial = exports.shared = exports.effect = exports.cycle = exports.on = exports.action = exports.cache = exports.prop = void 0;
const react_1 = require("react");
const reactive_box_1 = require("reactive-box");

@@ -10,2 +9,18 @@ Object.defineProperty(exports, "expr", { enumerable: true, get: function () { return reactive_box_1.expr; } });

Object.defineProperty(exports, "transaction", { enumerable: true, get: function () { return reactive_box_1.transaction; } });
let react = require('react');
let useRef;
let useReducer;
let useEffect;
let useMemo;
if (react) {
useRef = react.useRef;
useReducer = react.useReducer;
useEffect = react.useEffect;
useMemo = react.useMemo;
}
else {
useRef = useReducer = useEffect = useMemo = (() => {
throw new Error('Missed "react" dependency');
});
}
const shareds = new Map();

@@ -106,3 +121,3 @@ let initial_data;

function useForceUpdate() {
return react_1.useReducer(() => [], [])[1];
return useReducer(() => [], [])[1];
}

@@ -112,6 +127,6 @@ function observe(FunctionComponent) {

const forceUpdate = useForceUpdate();
const ref = react_1.useRef();
const ref = useRef();
if (!ref.current)
ref.current = reactive_box_1.expr(FunctionComponent, forceUpdate);
react_1.useEffect(() => ref.current[1], []);
useEffect(() => ref.current[1], []);
return ref.current[0].apply(this, arguments);

@@ -125,3 +140,3 @@ };

}
const h = react_1.useMemo(() => {
const h = useMemo(() => {
let inst, unsubs;

@@ -142,3 +157,3 @@ const stack = context_unsubs;

}, [Class, ...deps]);
react_1.useEffect(h[1], [h]);
useEffect(h[1], [h]);
return useValue(h[0]);

@@ -149,3 +164,3 @@ }

const forceUpdate = useForceUpdate();
const h = react_1.useMemo(() => {
const h = useMemo(() => {
if (target[0])

@@ -165,3 +180,3 @@ target = target[0]; // box or selector or custom reactive

}, [target, ...deps]);
react_1.useEffect(h[1], [h]);
useEffect(h[1], [h]);
return h[2] ? h[0]() : h[0];

@@ -168,0 +183,0 @@ }

{
"name": "realar",
"version": "0.4.10",
"version": "0.4.11",
"description": "React state manager",

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

},
"peerDependencies": {
"optionalDependencies": {
"react": ">=16.8.0"

@@ -92,3 +92,3 @@ },

},
"gitHead": "6a28ef6b50504bc6d2596d5469ffa5e11310ed82"
"gitHead": "0e3823c91af719c72541bf62fa06dafb13c13a83"
}

@@ -1,10 +0,4 @@

import { useRef, useReducer, useEffect, useMemo, FC } from 'react';
import React, { FC } from 'react';
import { expr, box, sel, transaction } from 'reactive-box';
const shareds = new Map();
let initial_data: any;
let context_unsubs: any;
let shared_unsubs = [] as any;
export {

@@ -32,2 +26,26 @@ prop,

let react = require('react');
let useRef: typeof React.useRef;
let useReducer: typeof React.useReducer;
let useEffect: typeof React.useEffect;
let useMemo: typeof React.useMemo;
if (react) {
useRef = react.useRef;
useReducer = react.useReducer;
useEffect = react.useEffect;
useMemo = react.useMemo;
} else {
useRef = useReducer = useEffect = useMemo = (() => {
throw new Error('Missed "react" dependency');
}) as any;
}
const shareds = new Map();
let initial_data: any;
let context_unsubs: any;
let shared_unsubs = [] as any;
type Ensurable<T> = T | void;

@@ -34,0 +52,0 @@

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