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

@dhmk/atom

Package Overview
Dependencies
Maintainers
0
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dhmk/atom - npm Package Compare versions

Comparing version 2.0.1-test.4 to 2.0.1-test.5

63

esm/atoms/derived.js

@@ -13,3 +13,3 @@ var __assign = (this && this.__assign) || function () {

import { runtime } from "../runtime";
import { useAtom, removeAtom, eacha, eachar, invalidate, } from "../shared";
import { useAtom, removeAtom, eachar, invalidate, } from "../shared";
import { EID, defaultAtomOptions, Id } from "../types";

@@ -24,3 +24,3 @@ var DerivedAtom = /** @class */ (function () {

this.ti = 0;
this.readFlag = 0;
this.readFlag = false;
this.isObserved = isEffect;

@@ -36,3 +36,2 @@ this.state = 3;

DerivedAtom.prototype.actualize = function () {
var _this = this;
if (this.state === 1 || this.state === 2) {

@@ -49,3 +48,3 @@ this.recalc = false;

if (this.state === 3) {
var mark_1 = (this.mark = new Id());
var mark = (this.mark = new Id());
var prevDeps = this.deps;

@@ -73,24 +72,28 @@ this.deps = new Array(prevDeps.length || 100);

this.deps.length = this.pdi;
// let i = 0,
// deps = prevDeps,
// s = deps.length,
// t,
// a;
// while (i < s) {
// a = deps[i++].a;
var i = 0, deps = prevDeps, s = deps.length, t = void 0, a = void 0;
while (i < s) {
a = deps[i++].a;
if (a.m !== mark)
removeAtom(a, this);
a.readFlag = false;
}
// eacha(prevDeps, (t) => {
// const a = t.a;
// if (a.m !== mark) removeAtom(a, this);
// a.readFlag = 0;
// }
eacha(prevDeps, function (t) {
var a = t.a;
if (a.m !== mark_1)
removeAtom(a, _this);
a.readFlag = 0;
});
// i = 0;
// deps = this.deps;
// s = deps.length;
// while (i < s) {
// t = deps[i++];
// a = t.a;
// });
i = 0;
deps = this.deps;
s = deps.length;
while (i < s) {
t = deps[i++];
a = t.a;
a.m = t.t;
if (a.readFlag) {
a.readFlag = false;
a.subs.add(this);
}
}
// eacha(this.deps, (t) => {
// const a = t.a;
// a.m = t.t;

@@ -101,11 +104,3 @@ // if (a.readFlag) {

// }
// }
eacha(this.deps, function (t) {
var a = t.a;
a.m = t.t;
if (a.readFlag) {
a.readFlag = 0;
a.subs.add(_this);
}
});
// });
if (!this.options.equals(nextValue, this.value)) {

@@ -136,3 +131,3 @@ this.value = nextValue;

a.ti = ti;
a.readFlag = 1;
a.readFlag = true;
};

@@ -139,0 +134,0 @@ DerivedAtom.prototype.dispose = function () {

@@ -23,3 +23,3 @@ var __assign = (this && this.__assign) || function () {

this.ti = 0;
this.readFlag = 0;
this.readFlag = false;
this.isObserved = false;

@@ -26,0 +26,0 @@ }

@@ -26,3 +26,3 @@ "use strict";

this.ti = 0;
this.readFlag = 0;
this.readFlag = false;
this.isObserved = isEffect;

@@ -38,3 +38,2 @@ this.state = 3;

DerivedAtom.prototype.actualize = function () {
var _this = this;
if (this.state === 1 || this.state === 2) {

@@ -51,3 +50,3 @@ this.recalc = false;

if (this.state === 3) {
var mark_1 = (this.mark = new types_1.Id());
var mark = (this.mark = new types_1.Id());
var prevDeps = this.deps;

@@ -75,24 +74,28 @@ this.deps = new Array(prevDeps.length || 100);

this.deps.length = this.pdi;
// let i = 0,
// deps = prevDeps,
// s = deps.length,
// t,
// a;
// while (i < s) {
// a = deps[i++].a;
var i = 0, deps = prevDeps, s = deps.length, t = void 0, a = void 0;
while (i < s) {
a = deps[i++].a;
if (a.m !== mark)
(0, shared_1.removeAtom)(a, this);
a.readFlag = false;
}
// eacha(prevDeps, (t) => {
// const a = t.a;
// if (a.m !== mark) removeAtom(a, this);
// a.readFlag = 0;
// }
(0, shared_1.eacha)(prevDeps, function (t) {
var a = t.a;
if (a.m !== mark_1)
(0, shared_1.removeAtom)(a, _this);
a.readFlag = 0;
});
// i = 0;
// deps = this.deps;
// s = deps.length;
// while (i < s) {
// t = deps[i++];
// a = t.a;
// });
i = 0;
deps = this.deps;
s = deps.length;
while (i < s) {
t = deps[i++];
a = t.a;
a.m = t.t;
if (a.readFlag) {
a.readFlag = false;
a.subs.add(this);
}
}
// eacha(this.deps, (t) => {
// const a = t.a;
// a.m = t.t;

@@ -103,11 +106,3 @@ // if (a.readFlag) {

// }
// }
(0, shared_1.eacha)(this.deps, function (t) {
var a = t.a;
a.m = t.t;
if (a.readFlag) {
a.readFlag = 0;
a.subs.add(_this);
}
});
// });
if (!this.options.equals(nextValue, this.value)) {

@@ -138,3 +133,3 @@ this.value = nextValue;

a.ti = ti;
a.readFlag = 1;
a.readFlag = true;
};

@@ -141,0 +136,0 @@ DerivedAtom.prototype.dispose = function () {

@@ -26,3 +26,3 @@ "use strict";

this.ti = 0;
this.readFlag = 0;
this.readFlag = false;
this.isObserved = false;

@@ -29,0 +29,0 @@ }

{
"name": "@dhmk/atom",
"version": "2.0.1-test.4",
"version": "2.0.1-test.5",
"description": "Lightweight mobx-like observable values, computed values and side-effects",

@@ -5,0 +5,0 @@ "keywords": [

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