Socket
Socket
Sign inDemoInstall

skatejs

Package Overview
Dependencies
Maintainers
8
Versions
151
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

skatejs - npm Package Compare versions

Comparing version 5.1.3 to 5.1.5

30

dist/es/with-children.js

@@ -23,2 +23,14 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

_createClass(_class2, [{
key: 'childrenUpdated',
// We automatically set a prop called children to invoke an update if it's
// been defined.
value: function childrenUpdated() {
_get(_class2.prototype.__proto__ || Object.getPrototypeOf(_class2.prototype), 'childrenUpdated', this) && _get(_class2.prototype.__proto__ || Object.getPrototypeOf(_class2.prototype), 'childrenUpdated', this).call(this);
if (this.props && this.props.hasOwnProperty('children')) {
this.props = { children: this.children };
}
}
}, {
key: 'connectedCallback',

@@ -29,13 +41,15 @@ value: function connectedCallback() {

var fn = this.childrenUpdated.bind(this);
this._mo = new MutationObserver(fn);
this._mo.observe(this, { childList: true });
fn();
var mo = new MutationObserver(fn);
mo.observe(this, { childList: true });
// We automatically set a prop called children to invoke an update if
// it's been defined.
if (this.props && this.props.hasOwnProperty('children')) {
this.props = { children: this.children };
}
}
}
}, {
key: 'disconnectedCallback',
value: function disconnectedCallback() {
_get(_class2.prototype.__proto__ || Object.getPrototypeOf(_class2.prototype), 'disconnectedCallback', this) && _get(_class2.prototype.__proto__ || Object.getPrototypeOf(_class2.prototype), 'disconnectedCallback', this).call(this);
if (this._mo) {
this._mo.disconnect();
}
}
}]);

@@ -42,0 +56,0 @@

export const withChildren = (Base = HTMLElement) => {
return class extends Base {
// We automatically set a prop called children to invoke an update if it's
// been defined.
childrenUpdated() {
super.childrenUpdated && super.childrenUpdated();
if (this.props && this.props.hasOwnProperty('children')) {
this.props = { children: this.children };
}
}
connectedCallback() {

@@ -8,11 +17,12 @@ super.connectedCallback && super.connectedCallback();

const fn = this.childrenUpdated.bind(this);
this._mo = new MutationObserver(fn);
this._mo.observe(this, { childList: true });
fn();
const mo = new MutationObserver(fn);
mo.observe(this, { childList: true });
}
}
// We automatically set a prop called children to invoke an update if
// it's been defined.
if (this.props && this.props.hasOwnProperty('children')) {
this.props = { children: this.children };
}
disconnectedCallback() {
super.disconnectedCallback && super.disconnectedCallback();
if (this._mo) {
this._mo.disconnect();
}

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

@@ -9,2 +9,11 @@ 'use strict';

// We automatically set a prop called children to invoke an update if it's
// been defined.
childrenUpdated() {
super.childrenUpdated && super.childrenUpdated();
if (this.props && this.props.hasOwnProperty('children')) {
this.props = { children: this.children };
}
}
connectedCallback() {

@@ -14,11 +23,12 @@ super.connectedCallback && super.connectedCallback();

const fn = this.childrenUpdated.bind(this);
this._mo = new MutationObserver(fn);
this._mo.observe(this, { childList: true });
fn();
const mo = new MutationObserver(fn);
mo.observe(this, { childList: true });
}
}
// We automatically set a prop called children to invoke an update if
// it's been defined.
if (this.props && this.props.hasOwnProperty('children')) {
this.props = { children: this.children };
}
disconnectedCallback() {
super.disconnectedCallback && super.disconnectedCallback();
if (this._mo) {
this._mo.disconnect();
}

@@ -25,0 +35,0 @@ }

@@ -26,3 +26,3 @@ {

"types": "src/index.d.ts",
"version": "5.1.3"
"version": "5.1.5"
}
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