Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

realdom

Package Overview
Dependencies
Maintainers
0
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

realdom - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

2

package.json
{
"name": "realdom",
"version": "0.0.6",
"version": "0.0.7",
"author": "Fedot Kriutchenko <fodyadev@gmail.com>",

@@ -5,0 +5,0 @@ "description": "",

@@ -5,36 +5,29 @@ import { runWithState, getCurrentHandler } from './state.js';

const symbol = Symbol();
function builder(effect) {
let names = [];
const tasks = [];
const Builder = (effect, tasks=[], names=[]) => new Proxy(
(...args) => args[0] === symbol
? (args[0] = tasks, effect(...args))
: Builder(effect, [...tasks, { names, args }], []),
{ get: (_, k) => k === symbol
? effect[k]
: Builder(effect, tasks, [...names, k])
});
const call = (...args) => {
if (args[0] === symbol) {
const a = args.slice(1);
let res;
for (const t of tasks) res ??= effect(t.names, t.args, ...a);
return res;
} else {
tasks.push({ names, args });
names = [];
}
return p;
const elementBuilder = func => {
const effect = (tasks, node, init) => {
let res;
for (const {names, args} of tasks) res ??= func(args, node, init);
return res;
}
const get = (_, k) => {
if (k === symbol) return effect[k];
names.push(k);
return p;
}
let p; return p = new Proxy(call, { get });
effect[symbol] = 1;
return Builder(effect);
}
export const Operator = (reactive, func) => {
const effect = (names, args, node, init) => {
const r = typeof reactive == 'function' ? reactive(args) : reactive;
if (init && !r || r) func(node, names, args);
const effect = (tasks, node, init) => {
for (const {names, args} of tasks) {
const r = typeof reactive == 'function' ? reactive(args) : reactive;
if (init && !r || r) func(node, names, args);
}
}
effect[symbol] = 2;
return new Proxy(
(...a) => builder(effect)(...a),
{ get: (_, k) => builder(effect)[k] }
);
return Builder(effect);
}

@@ -46,7 +39,3 @@

const elementBuilder = effect => {
effect[symbol] = 1;
return builder(effect);
}
export const Element = tag => elementBuilder((_, content, node, init) => {
export const Element = tag => elementBuilder((content, node, init) => {
const node_ = node;

@@ -53,0 +42,0 @@ if (!node && (init = true)) switch (tag) {

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