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.1 to 2.0.1-test.2

49

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 = false;
this.readFlag = 0;
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,16 +72,34 @@ this.deps = new Array(prevDeps.length || 100);

this.deps.length = this.pdi;
eacha(prevDeps, function (t) {
var a = t.a;
if (a.m !== mark_1)
removeAtom(a, _this);
a.readFlag = false;
});
eacha(this.deps, function (t) {
var a = t.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 = 0;
}
// eacha(prevDeps, (t) => {
// const a = t.a;
// if (a.m !== mark) removeAtom(a, this);
// a.readFlag = false;
// });
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);
a.readFlag = 0;
a.subs.add(this);
}
});
}
// eacha(this.deps, (t) => {
// const a = t.a;
// a.m = t.t;
// if (a.readFlag) {
// a.readFlag = false;
// a.subs.add(this);
// }
// });
if (!this.options.equals(nextValue, this.value)) {

@@ -113,3 +130,3 @@ this.value = nextValue;

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

@@ -116,0 +133,0 @@ DerivedAtom.prototype.dispose = function () {

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

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

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

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

this.ti = 0;
this.readFlag = false;
this.readFlag = 0;
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,16 +74,34 @@ this.deps = new Array(prevDeps.length || 100);

this.deps.length = this.pdi;
(0, shared_1.eacha)(prevDeps, function (t) {
var a = t.a;
if (a.m !== mark_1)
(0, shared_1.removeAtom)(a, _this);
a.readFlag = false;
});
(0, shared_1.eacha)(this.deps, function (t) {
var a = t.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 = 0;
}
// eacha(prevDeps, (t) => {
// const a = t.a;
// if (a.m !== mark) removeAtom(a, this);
// a.readFlag = false;
// });
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);
a.readFlag = 0;
a.subs.add(this);
}
});
}
// eacha(this.deps, (t) => {
// const a = t.a;
// a.m = t.t;
// if (a.readFlag) {
// a.readFlag = false;
// a.subs.add(this);
// }
// });
if (!this.options.equals(nextValue, this.value)) {

@@ -115,3 +132,3 @@ this.value = nextValue;

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

@@ -118,0 +135,0 @@ DerivedAtom.prototype.dispose = function () {

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

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

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

{
"name": "@dhmk/atom",
"version": "2.0.1-test.1",
"version": "2.0.1-test.2",
"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