sling-framework
Advanced tools
Comparing version 1.12.0 to 1.12.2
@@ -48,2 +48,3 @@ "use strict"; | ||
value: function dispatchEventAndMethod(evtName, detail) { | ||
var target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this; | ||
var event = new CustomEvent(evtName, { | ||
@@ -53,4 +54,4 @@ bubbles: true, | ||
}); | ||
var method = this["on".concat(evtName)]; | ||
this.dispatchEvent(event); | ||
var method = target["on".concat(evtName)]; | ||
target.dispatchEvent(event); | ||
@@ -57,0 +58,0 @@ if ((0, _slingHelpers.isFunction)(method)) { |
@@ -30,2 +30,3 @@ "use strict"; | ||
var Base = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : HTMLElement; | ||
var CusEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : CustomEvent; | ||
return ( | ||
@@ -49,8 +50,9 @@ /*#__PURE__*/ | ||
value: function dispatchEventAndMethod(evtName, detail) { | ||
var event = new CustomEvent(evtName, { | ||
var target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this; | ||
var event = new CusEvent(evtName, { | ||
bubbles: true, | ||
detail: detail | ||
}); | ||
var method = this["on".concat(evtName)]; | ||
this.dispatchEvent(event); | ||
var method = target["on".concat(evtName)]; | ||
target.dispatchEvent(event); | ||
@@ -57,0 +59,0 @@ if ((0, _slingHelpers.isFunction)(method)) { |
@@ -74,3 +74,3 @@ "use strict"; | ||
}).catch(function (err) { | ||
_this2.requestErrors = _toConsumableArray(_this2.requestErrors).concat([err]); | ||
_this2.requestErrors = [].concat(_toConsumableArray(_this2.requestErrors), [err]); | ||
@@ -109,2 +109,3 @@ _this2.dispatchEventAndMethod('requesterror', { | ||
value: function request(oneOrManyRequests) { | ||
this.requestErrors = []; | ||
var requestSingle = this.requestSingle.bind(this); | ||
@@ -111,0 +112,0 @@ |
@@ -89,3 +89,3 @@ "use strict"; | ||
get: function get() { | ||
return _toConsumableArray(_get(_getPrototypeOf(_class2), "observedAttributes", this) || []).concat(_toConsumableArray(this.requestAttrNames)); | ||
return [].concat(_toConsumableArray(_get(_getPrototypeOf(_class2), "observedAttributes", this) || []), _toConsumableArray(this.requestAttrNames)); | ||
} | ||
@@ -92,0 +92,0 @@ }]); |
@@ -16,3 +16,3 @@ "use strict"; | ||
dispatchEventAndMethod(evtName, detail) { | ||
dispatchEventAndMethod(evtName, detail, target = this) { | ||
const event = new CustomEvent(evtName, { | ||
@@ -22,4 +22,4 @@ bubbles: true, | ||
}); | ||
const method = this[`on${evtName}`]; | ||
this.dispatchEvent(event); | ||
const method = target[`on${evtName}`]; | ||
target.dispatchEvent(event); | ||
@@ -26,0 +26,0 @@ if ((0, _slingHelpers.isFunction)(method)) { |
@@ -10,3 +10,3 @@ "use strict"; | ||
const withEventDispatch = (Base = HTMLElement) => class extends Base { | ||
const withEventDispatch = (Base = HTMLElement, CusEvent = CustomEvent) => class extends Base { | ||
constructor() { | ||
@@ -17,9 +17,9 @@ super(); | ||
dispatchEventAndMethod(evtName, detail) { | ||
const event = new CustomEvent(evtName, { | ||
dispatchEventAndMethod(evtName, detail, target = this) { | ||
const event = new CusEvent(evtName, { | ||
bubbles: true, | ||
detail | ||
}); | ||
const method = this[`on${evtName}`]; | ||
this.dispatchEvent(event); | ||
const method = target[`on${evtName}`]; | ||
target.dispatchEvent(event); | ||
@@ -26,0 +26,0 @@ if ((0, _slingHelpers.isFunction)(method)) { |
@@ -51,2 +51,3 @@ "use strict"; | ||
request(oneOrManyRequests) { | ||
this.requestErrors = []; | ||
const requestSingle = this.requestSingle.bind(this); | ||
@@ -53,0 +54,0 @@ |
@@ -40,2 +40,3 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
value: function dispatchEventAndMethod(evtName, detail) { | ||
var target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this; | ||
var event = new CustomEvent(evtName, { | ||
@@ -45,4 +46,4 @@ bubbles: true, | ||
}); | ||
var method = this["on".concat(evtName)]; | ||
this.dispatchEvent(event); | ||
var method = target["on".concat(evtName)]; | ||
target.dispatchEvent(event); | ||
@@ -49,0 +50,0 @@ if (isFunction(method)) { |
@@ -22,2 +22,3 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
var Base = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : HTMLElement; | ||
var CusEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : CustomEvent; | ||
return ( | ||
@@ -41,8 +42,9 @@ /*#__PURE__*/ | ||
value: function dispatchEventAndMethod(evtName, detail) { | ||
var event = new CustomEvent(evtName, { | ||
var target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this; | ||
var event = new CusEvent(evtName, { | ||
bubbles: true, | ||
detail: detail | ||
}); | ||
var method = this["on".concat(evtName)]; | ||
this.dispatchEvent(event); | ||
var method = target["on".concat(evtName)]; | ||
target.dispatchEvent(event); | ||
@@ -49,0 +51,0 @@ if (isFunction(method)) { |
@@ -67,3 +67,3 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
}).catch(function (err) { | ||
_this2.requestErrors = _toConsumableArray(_this2.requestErrors).concat([err]); | ||
_this2.requestErrors = [].concat(_toConsumableArray(_this2.requestErrors), [err]); | ||
@@ -102,2 +102,3 @@ _this2.dispatchEventAndMethod('requesterror', { | ||
value: function request(oneOrManyRequests) { | ||
this.requestErrors = []; | ||
var requestSingle = this.requestSingle.bind(this); | ||
@@ -104,0 +105,0 @@ |
@@ -82,3 +82,3 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
get: function get() { | ||
return _toConsumableArray(_get(_getPrototypeOf(_class2), "observedAttributes", this) || []).concat(_toConsumableArray(this.requestAttrNames)); | ||
return [].concat(_toConsumableArray(_get(_getPrototypeOf(_class2), "observedAttributes", this) || []), _toConsumableArray(this.requestAttrNames)); | ||
} | ||
@@ -85,0 +85,0 @@ }]); |
@@ -11,3 +11,3 @@ import { isFunction } from 'sling-helpers'; | ||
dispatchEventAndMethod(evtName, detail) { | ||
dispatchEventAndMethod(evtName, detail, target = this) { | ||
const event = new CustomEvent(evtName, { | ||
@@ -18,5 +18,5 @@ bubbles: true, | ||
const method = this[`on${evtName}`]; | ||
const method = target[`on${evtName}`]; | ||
this.dispatchEvent(event); | ||
target.dispatchEvent(event); | ||
@@ -23,0 +23,0 @@ if (isFunction(method)) { |
import { isFunction } from 'sling-helpers'; | ||
export const withEventDispatch = (Base = HTMLElement) => | ||
export const withEventDispatch = (Base = HTMLElement, CusEvent = CustomEvent) => | ||
class extends Base { | ||
@@ -11,4 +11,4 @@ constructor() { | ||
dispatchEventAndMethod(evtName, detail) { | ||
const event = new CustomEvent(evtName, { | ||
dispatchEventAndMethod(evtName, detail, target = this) { | ||
const event = new CusEvent(evtName, { | ||
bubbles: true, | ||
@@ -18,5 +18,5 @@ detail, | ||
const method = this[`on${evtName}`]; | ||
const method = target[`on${evtName}`]; | ||
this.dispatchEvent(event); | ||
target.dispatchEvent(event); | ||
@@ -23,0 +23,0 @@ if (isFunction(method)) { |
@@ -46,2 +46,3 @@ export const withLoadingAndErrorHandling = (Base = class {}) => | ||
request(oneOrManyRequests) { | ||
this.requestErrors = []; | ||
const requestSingle = this.requestSingle.bind(this); | ||
@@ -48,0 +49,0 @@ |
{ | ||
"name": "sling-framework", | ||
"version": "1.12.0", | ||
"version": "1.12.2", | ||
"description": "Sling Framework", | ||
@@ -10,4 +10,4 @@ "module": "src/index.js", | ||
"dependencies": { | ||
"sling-helpers": "^1.12.0" | ||
"sling-helpers": "^1.12.2" | ||
} | ||
} |
@@ -11,3 +11,3 @@ import { isFunction } from 'sling-helpers'; | ||
dispatchEventAndMethod(evtName, detail) { | ||
dispatchEventAndMethod(evtName, detail, target = this) { | ||
const event = new CustomEvent(evtName, { | ||
@@ -18,5 +18,5 @@ bubbles: true, | ||
const method = this[`on${evtName}`]; | ||
const method = target[`on${evtName}`]; | ||
this.dispatchEvent(event); | ||
target.dispatchEvent(event); | ||
@@ -23,0 +23,0 @@ if (isFunction(method)) { |
import { isFunction } from 'sling-helpers'; | ||
export const withEventDispatch = (Base = HTMLElement) => | ||
export const withEventDispatch = (Base = HTMLElement, CusEvent = CustomEvent) => | ||
class extends Base { | ||
@@ -11,4 +11,4 @@ constructor() { | ||
dispatchEventAndMethod(evtName, detail) { | ||
const event = new CustomEvent(evtName, { | ||
dispatchEventAndMethod(evtName, detail, target = this) { | ||
const event = new CusEvent(evtName, { | ||
bubbles: true, | ||
@@ -18,5 +18,5 @@ detail, | ||
const method = this[`on${evtName}`]; | ||
const method = target[`on${evtName}`]; | ||
this.dispatchEvent(event); | ||
target.dispatchEvent(event); | ||
@@ -23,0 +23,0 @@ if (isFunction(method)) { |
@@ -46,2 +46,3 @@ export const withLoadingAndErrorHandling = (Base = class {}) => | ||
request(oneOrManyRequests) { | ||
this.requestErrors = []; | ||
const requestSingle = this.requestSingle.bind(this); | ||
@@ -48,0 +49,0 @@ |
@@ -11,3 +11,3 @@ import chai from 'chai'; | ||
describe('withLoading', () => { | ||
describe('withLoadingAndErrorHandling', () => { | ||
describe('#requestSingle()', () => { | ||
@@ -14,0 +14,0 @@ let dummy; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1278213
11
31133
Updatedsling-helpers@^1.12.2