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

stump-cycle-dom

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stump-cycle-dom - npm Package Compare versions

Comparing version 0.0.4 to 0.0.7

shrinkwrap.yaml

1

lib/cjs/EventDelegator.d.ts

@@ -41,2 +41,3 @@ import { Stream } from 'xstream';

private resetEventListeners;
private resetNonBubblingListeners;
private putNonBubblingListener;

@@ -43,0 +44,0 @@ private onEvent;

@@ -82,2 +82,3 @@ "use strict";

}
// this.resetNonBubblingListeners();
_this.nonBubblingListenersToAdd.forEach(function (arr) {

@@ -115,4 +116,7 @@ _this.setupNonBubblingListener(arr);

toRemove.push([type, element]);
if (element.sub) {
element.sub.unsubscribe();
var subs_1 = element.subs;
if (subs_1) {
Object.keys(subs_1.forEach(function (key) {
subs_1[key].unsubscribe();
}));
}

@@ -187,3 +191,2 @@ }

EventDelegator.prototype.setupNonBubblingListener = function (input) {
var _this = this;
var eventType = input[0], elementFinder = input[1], destination = input[2];

@@ -197,8 +200,11 @@ if (!this.origin) {

var count_1 = 0;
var self_1 = this;
elements.forEach(function (element) {
if (!element.has_listener) {
var _a;
var subs = element.subs;
if (!element.sub) {
count_1 = count_1 + 1;
var sub = fromEvent_1.fromEvent(element, eventType, false, false, destination.passive).subscribe({
next: function (ev) {
return _this.onEvent(eventType, ev, !!destination.passive, false);
return self_1.onEvent(eventType, ev, !!destination.passive, false);
},

@@ -209,10 +215,10 @@ error: function () { },

if (count_1 === 0) {
_this.nonBubblingListenersToAdd.delete(input);
self_1.nonBubblingListenersToAdd.delete(input);
}
},
});
if (!_this.nonBubblingListeners.has(eventType)) {
_this.nonBubblingListeners.set(eventType, new Map());
if (!self_1.nonBubblingListeners.has(eventType)) {
self_1.nonBubblingListeners.set(eventType, new Map());
}
var map = _this.nonBubblingListeners.get(eventType);
var map = self_1.nonBubblingListeners.get(eventType);
if (!map) {

@@ -222,4 +228,3 @@ return;

map.set(element, { sub: sub, destination: destination });
element.has_element = true;
element.sub = sub;
element.subs = __assign({}, subs, (_a = {}, _a[eventType] = sub, _a));
}

@@ -242,2 +247,33 @@ });

};
EventDelegator.prototype.resetNonBubblingListeners = function () {
var _this = this;
var newMap = new Map();
var insert = utils_1.makeInsert(newMap);
this.nonBubblingListeners.forEach(function (map, type) {
map.forEach(function (value, elm) {
if (!document.body.contains(elm)) {
var sub = value.sub, destination_1 = value.destination;
if (sub) {
sub.unsubscribe();
}
var elementFinder = new ElementFinder_1.ElementFinder(destination_1.scopeChecker.namespace, _this.isolateModule);
var newElms = elementFinder.call();
newElms.forEach(function (newElm) {
var newSub = fromEvent_1.fromEvent(newElm, type, false, false, destination_1.passive).subscribe({
next: function (event) {
return _this.onEvent(type, event, !!destination_1.passive, false);
},
error: function () { },
complete: function () { },
});
insert(type, newElm, { sub: newSub, destination: destination_1 });
});
}
else {
insert(type, elm, value);
}
});
_this.nonBubblingListeners = newMap;
});
};
EventDelegator.prototype.putNonBubblingListener = function (eventType, elm, useCapture, passive) {

@@ -244,0 +280,0 @@ var map = this.nonBubblingListeners.get(eventType);

@@ -41,2 +41,3 @@ import { Stream } from 'xstream';

private resetEventListeners;
private resetNonBubblingListeners;
private putNonBubblingListener;

@@ -43,0 +44,0 @@ private onEvent;

60

lib/es6/EventDelegator.js

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

import { ScopeChecker } from './ScopeChecker';
import { getSelectors } from './utils';
import { getSelectors, makeInsert } from './utils';
import { ElementFinder } from './ElementFinder';

@@ -81,2 +81,3 @@ import SymbolTree from './SymbolTree';

}
// this.resetNonBubblingListeners();
_this.nonBubblingListenersToAdd.forEach(function (arr) {

@@ -114,4 +115,7 @@ _this.setupNonBubblingListener(arr);

toRemove.push([type, element]);
if (element.sub) {
element.sub.unsubscribe();
var subs_1 = element.subs;
if (subs_1) {
Object.keys(subs_1.forEach(function (key) {
subs_1[key].unsubscribe();
}));
}

@@ -186,3 +190,2 @@ }

EventDelegator.prototype.setupNonBubblingListener = function (input) {
var _this = this;
var eventType = input[0], elementFinder = input[1], destination = input[2];

@@ -196,8 +199,11 @@ if (!this.origin) {

var count_1 = 0;
var self_1 = this;
elements.forEach(function (element) {
if (!element.has_listener) {
var _a;
var subs = element.subs;
if (!element.sub) {
count_1 = count_1 + 1;
var sub = fromEvent(element, eventType, false, false, destination.passive).subscribe({
next: function (ev) {
return _this.onEvent(eventType, ev, !!destination.passive, false);
return self_1.onEvent(eventType, ev, !!destination.passive, false);
},

@@ -208,10 +214,10 @@ error: function () { },

if (count_1 === 0) {
_this.nonBubblingListenersToAdd.delete(input);
self_1.nonBubblingListenersToAdd.delete(input);
}
},
});
if (!_this.nonBubblingListeners.has(eventType)) {
_this.nonBubblingListeners.set(eventType, new Map());
if (!self_1.nonBubblingListeners.has(eventType)) {
self_1.nonBubblingListeners.set(eventType, new Map());
}
var map = _this.nonBubblingListeners.get(eventType);
var map = self_1.nonBubblingListeners.get(eventType);
if (!map) {

@@ -221,4 +227,3 @@ return;

map.set(element, { sub: sub, destination: destination });
element.has_element = true;
element.sub = sub;
element.subs = __assign({}, subs, (_a = {}, _a[eventType] = sub, _a));
}

@@ -241,2 +246,33 @@ });

};
EventDelegator.prototype.resetNonBubblingListeners = function () {
var _this = this;
var newMap = new Map();
var insert = makeInsert(newMap);
this.nonBubblingListeners.forEach(function (map, type) {
map.forEach(function (value, elm) {
if (!document.body.contains(elm)) {
var sub = value.sub, destination_1 = value.destination;
if (sub) {
sub.unsubscribe();
}
var elementFinder = new ElementFinder(destination_1.scopeChecker.namespace, _this.isolateModule);
var newElms = elementFinder.call();
newElms.forEach(function (newElm) {
var newSub = fromEvent(newElm, type, false, false, destination_1.passive).subscribe({
next: function (event) {
return _this.onEvent(type, event, !!destination_1.passive, false);
},
error: function () { },
complete: function () { },
});
insert(type, newElm, { sub: newSub, destination: destination_1 });
});
}
else {
insert(type, elm, value);
}
});
_this.nonBubblingListeners = newMap;
});
};
EventDelegator.prototype.putNonBubblingListener = function (eventType, elm, useCapture, passive) {

@@ -243,0 +279,0 @@ var map = this.nonBubblingListeners.get(eventType);

{
"name": "stump-cycle-dom",
"version": "0.0.4",
"version": "0.0.7",
"description": "The standard DOM Driver for Cycle.js, based on Snabbdom",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -119,2 +119,3 @@ import xs, {Stream, Subscription} from 'xstream';

// this.resetNonBubblingListeners();
this.nonBubblingListenersToAdd.forEach(arr => {

@@ -162,4 +163,7 @@ this.setupNonBubblingListener(arr);

toRemove.push([type, element]);
if ((element as any).sub) {
(element as any).sub.unsubscribe();
const subs = (element as any).subs
if (subs) {
Object.keys(subs.forEach((key: any) => {
subs[key].unsubscribe();
}))
}

@@ -277,4 +281,6 @@ }

let count = 0;
const self = this
elements.forEach((element: Element) => {
if (!(element as any).has_listener) {
const subs = (element as any).subs
if (!(element as any).sub) {
count = count + 1;

@@ -290,13 +296,14 @@

next: (ev: Event) =>
this.onEvent(eventType, ev, !!destination.passive, false),
self.onEvent(eventType, ev, !!destination.passive, false),
error: () => {},
complete: () => {
count = count - 1;
if (count === 0) {
this.nonBubblingListenersToAdd.delete(input);
self.nonBubblingListenersToAdd.delete(input);
}
},
});
if (!this.nonBubblingListeners.has(eventType)) {
this.nonBubblingListeners.set(
if (!self.nonBubblingListeners.has(eventType)) {
self.nonBubblingListeners.set(
eventType,

@@ -306,3 +313,3 @@ new Map<Element, NonBubblingListener>()

}
const map = this.nonBubblingListeners.get(eventType);
const map = self.nonBubblingListeners.get(eventType);
if (!map) {

@@ -312,4 +319,7 @@ return;

map.set(element, {sub, destination});
(element as any).has_element = true;
(element as any).sub = sub;
(element as any).subs = {
...subs,
[eventType]: sub
}
}

@@ -333,2 +343,42 @@ });

private resetNonBubblingListeners(): void {
const newMap = new Map<string, Map<Element, NonBubblingListener>>();
const insert = makeInsert(newMap);
this.nonBubblingListeners.forEach((map, type) => {
map.forEach((value, elm) => {
if (!document.body.contains(elm)) {
const {sub, destination} = value;
if (sub) {
sub.unsubscribe();
}
const elementFinder = new ElementFinder(
destination.scopeChecker.namespace,
this.isolateModule
);
const newElms = elementFinder.call();
newElms.forEach((newElm) => {
const newSub = fromEvent(
newElm,
type,
false,
false,
destination.passive
).subscribe({
next: event =>
this.onEvent(type, event, !!destination.passive, false),
error: () => {},
complete: () => {},
});
insert(type, newElm, {sub: newSub, destination});
})
} else {
insert(type, elm, value);
}
});
this.nonBubblingListeners = newMap;
});
}
private putNonBubblingListener(

@@ -335,0 +385,0 @@ eventType: string,

Sorry, the diff of this file is not supported yet

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