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.5.6 to 0.5.7

4

build/index.d.ts
import { FC } from 'react';
import { transaction, untrack } from 'reactive-box';
export { value, selector, prop, cache, signal, on, sync, cycle, effect, shared, initial, observe, useValue, useLocal, useShared, useScoped, Scope, free, mock, unmock, transaction, untrack, Ensurable, };
export { value, selector, prop, cache, signal, on, sync, cycle, loop, effect, isolate, shared, initial, observe, useValue, useLocal, useShared, useScoped, Scope, free, mock, unmock, transaction, untrack, Ensurable, };
declare type Ensurable<T> = T | void;

@@ -43,2 +43,4 @@ declare type Callable<T> = {

declare function cycle(body: () => void): () => void;
declare function loop(body: () => Promise<any>): () => void;
declare function isolate(): () => void;
declare function initial(data: any): void;

@@ -45,0 +47,0 @@ declare function mock<M>(target: (new (init?: any) => M) | ((init?: any) => M), mocked: M): M;

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.untrack = exports.transaction = exports.unmock = exports.mock = exports.free = exports.Scope = exports.useScoped = exports.useShared = exports.useLocal = exports.useValue = exports.observe = exports.initial = exports.shared = exports.effect = exports.cycle = exports.sync = exports.on = exports.signal = exports.cache = exports.prop = exports.selector = exports.value = void 0;
exports.untrack = exports.transaction = exports.unmock = exports.mock = exports.free = exports.Scope = exports.useScoped = exports.useShared = exports.useLocal = exports.useValue = exports.observe = exports.initial = exports.shared = exports.isolate = exports.effect = exports.loop = exports.cycle = exports.sync = exports.on = exports.signal = exports.cache = exports.prop = exports.selector = exports.value = void 0;
const reactive_box_1 = require("reactive-box");

@@ -139,2 +148,26 @@ Object.defineProperty(exports, "transaction", { enumerable: true, get: function () { return reactive_box_1.transaction; } });

exports.cycle = cycle;
function loop(body) {
let running = 1;
const fn = () => __awaiter(this, void 0, void 0, function* () {
while (running)
yield body();
});
const unsub = () => {
if (running)
running = 0;
};
if (context_unsubs)
context_unsubs.push(unsub);
fn();
return unsub;
}
exports.loop = loop;
function isolate() {
const stack = context_unsubs;
context_unsubs = 0;
return () => {
context_unsubs = stack;
};
}
exports.isolate = isolate;
function initial(data) {

@@ -141,0 +174,0 @@ initial_data = data;

{
"name": "realar",
"version": "0.5.6",
"version": "0.5.7",
"description": "React state manager",

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

},
"gitHead": "ec6e76fa6252e0b5dddb2b09d4945fa16a20e5e3"
"gitHead": "aaad48201cefd43de565a59d466fb78ffdcfda7a"
}

@@ -430,3 +430,3 @@ # Realar

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

@@ -433,0 +433,0 @@ ### Demos

@@ -13,3 +13,5 @@ import React, { Context, FC } from 'react';

cycle,
loop,
effect,
isolate,
shared,

@@ -220,2 +222,23 @@ initial,

function loop(body: () => Promise<any>) {
let running = 1;
const fn = async () => {
while (running) await body();
}
const unsub = () => {
if (running) running = 0;
};
if (context_unsubs) context_unsubs.push(unsub);
fn();
return unsub;
}
function isolate() {
const stack = context_unsubs;
context_unsubs = 0;
return () => {
context_unsubs = stack
};
}
function initial(data: any): void {

@@ -222,0 +245,0 @@ initial_data = data;

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