New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hydro-js

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hydro-js - npm Package Compare versions

Comparing version 1.5.6 to 1.5.7

4

CHANGELOG.md
# Changelog
## 1.5.7- 2021-01-06
- Performance and Memory improvements
## 1.5.6- 2021-01-05

@@ -4,0 +8,0 @@

25

dist/library.js

@@ -941,6 +941,6 @@ // Safari Polyfills

// Core of the library
function generateProxy(obj = {}) {
function generateProxy(obj) {
const handlers = Symbol("handlers"); // For observer pattern
const boundFunctions = new WeakMap();
const proxy = new Proxy(obj, {
const proxy = new Proxy(obj ?? {}, {
// If receiver is a getter, then it is the object on which the search first started for the property|key -> Proxy

@@ -1106,3 +1106,3 @@ set(target, key, val, receiver) {

// If oldVal is a Proxy - clean it
!reuseElements && cleanProxy(oldVal);
!reuseElements && oldVal && cleanProxy(oldVal);
return returnSet;

@@ -1182,8 +1182,5 @@ },

});
if (!Reflect.has(proxy, _boundFunctions))
queueMicrotask(() => {
if (proxy === hydro)
Reflect.defineProperty(proxy, _boundFunctions, {
value: boundFunctions,
});
if (!obj)
Reflect.defineProperty(proxy, _boundFunctions, {
value: boundFunctions,
});

@@ -1341,2 +1338,3 @@ return proxy;

setReactivity(rootElem);
onCleanup(unset, rootElem, data);
viewElements = false;

@@ -1350,2 +1348,3 @@ observe(data, (newData, oldData) => {

rootElem.textContent = "";
schedule(() => oldData.forEach((data) => (data = null)));
}

@@ -1360,3 +1359,5 @@ else if (reuseElements) {

// Add to existing
if (oldData?.length && newData?.length > oldData?.length) {
if (oldData?.length &&
newData?.length > oldData?.length &&
newData[0] === oldData[0]) {
const length = oldData.length;

@@ -1371,2 +1372,6 @@ const slicedData = newData.slice(length);

else if (oldData?.length === 0 || (!reuseElements && newData?.length)) {
if (!reuseElements && oldData?.length && rootElem.hasChildNodes()) {
rootElem.textContent = "";
schedule(() => oldData.forEach((data) => (data = null)));
}
const elements = newData.map(renderFunction);

@@ -1373,0 +1378,0 @@ rootElem.append(...elements);

{
"name": "hydro-js",
"version": "1.5.6",
"version": "1.5.7",
"description": "A lightweight reactive library",

@@ -32,3 +32,3 @@ "type": "module",

"@types/concurrently": "^6.4.0",
"@web/test-runner": "^0.13.24",
"@web/test-runner": "^0.13.25",
"@web/test-runner-playwright": "^0.8.8",

@@ -35,0 +35,0 @@ "concurrently": "^7.0.0",

@@ -1237,7 +1237,7 @@ declare global {

// Core of the library
function generateProxy(obj = {}): hydroObject {
function generateProxy(obj?: Record<PropertyKey, unknown>): hydroObject {
const handlers = Symbol("handlers"); // For observer pattern
const boundFunctions = new WeakMap<Function, Function>();
const proxy = new Proxy(obj, {
const proxy = new Proxy(obj ?? {}, {
// If receiver is a getter, then it is the object on which the search first started for the property|key -> Proxy

@@ -1416,3 +1416,3 @@ set(target, key, val, receiver) {

// If oldVal is a Proxy - clean it
!reuseElements && cleanProxy(oldVal);
!reuseElements && oldVal && cleanProxy(oldVal);

@@ -1494,8 +1494,5 @@ return returnSet;

});
if (!Reflect.has(proxy, _boundFunctions))
queueMicrotask(() => {
if (proxy === hydro)
Reflect.defineProperty(proxy, _boundFunctions, {
value: boundFunctions,
});
if (!obj)
Reflect.defineProperty(proxy, _boundFunctions, {
value: boundFunctions,
});

@@ -1669,2 +1666,3 @@

if (rootElem.hasChildNodes()) setReactivity(rootElem);
onCleanup(unset, rootElem, data);

@@ -1682,2 +1680,3 @@ viewElements = false;

rootElem.textContent = "";
schedule(() => oldData.forEach((data) => (data = null)));
} else if (reuseElements) {

@@ -1692,3 +1691,7 @@ for (let i = 0; i < oldData?.length && newData?.length; i++) {

// Add to existing
if (oldData?.length && newData?.length > oldData?.length) {
if (
oldData?.length &&
newData?.length > oldData?.length &&
newData[0] === oldData[0]
) {
const length = oldData.length;

@@ -1705,2 +1708,7 @@ const slicedData = newData.slice(length);

else if (oldData?.length === 0 || (!reuseElements && newData?.length)) {
if (!reuseElements && oldData?.length && rootElem.hasChildNodes()) {
rootElem.textContent = "";
schedule(() => oldData.forEach((data) => (data = null)));
}
const elements = newData.map(renderFunction);

@@ -1707,0 +1715,0 @@ rootElem.append(...elements);

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