Comparing version 1.4.0 to 1.5.0
@@ -82,3 +82,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
if (true) { | ||
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), | ||
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(1)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), | ||
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? | ||
@@ -88,3 +88,3 @@ (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), | ||
} else if (typeof exports !== "undefined") { | ||
factory(module, exports); | ||
factory(module, exports, require('debounce')); | ||
} else { | ||
@@ -94,7 +94,7 @@ var mod = { | ||
}; | ||
factory(mod, mod.exports); | ||
factory(mod, mod.exports, global.debounce); | ||
global.index = mod.exports; | ||
} | ||
})(this, function (module, exports) { | ||
"use strict"; | ||
})(this, function (module, exports, _debounce) { | ||
'use strict'; | ||
@@ -196,3 +196,3 @@ Object.defineProperty(exports, "__esModule", { | ||
function digest() { | ||
var digest = (0, _debounce2.default)(function () { | ||
if (!state.initialised) { | ||
@@ -202,3 +202,3 @@ return; | ||
updateFn.call(comp, state); | ||
} | ||
}, 1); | ||
@@ -209,2 +209,10 @@ return comp; | ||
var _debounce2 = _interopRequireDefault(_debounce); | ||
function _interopRequireDefault(obj) { | ||
return obj && obj.__esModule ? obj : { | ||
default: obj | ||
}; | ||
} | ||
function _classCallCheck(instance, Constructor) { | ||
@@ -232,5 +240,67 @@ if (!(instance instanceof Constructor)) { | ||
module.exports = exports["default"]; | ||
module.exports = exports['default']; | ||
}); | ||
/***/ }), | ||
/* 1 */ | ||
/***/ (function(module, exports) { | ||
/** | ||
* Returns a function, that, as long as it continues to be invoked, will not | ||
* be triggered. The function will be called after it stops being called for | ||
* N milliseconds. If `immediate` is passed, trigger the function on the | ||
* leading edge, instead of the trailing. The function also has a property 'clear' | ||
* that is a function which will clear the timer to prevent previously scheduled executions. | ||
* | ||
* @source underscore.js | ||
* @see http://unscriptable.com/2009/03/20/debouncing-javascript-methods/ | ||
* @param {Function} function to wrap | ||
* @param {Number} timeout in ms (`100`) | ||
* @param {Boolean} whether to execute at the beginning (`false`) | ||
* @api public | ||
*/ | ||
module.exports = function debounce(func, wait, immediate){ | ||
var timeout, args, context, timestamp, result; | ||
if (null == wait) wait = 100; | ||
function later() { | ||
var last = Date.now() - timestamp; | ||
if (last < wait && last >= 0) { | ||
timeout = setTimeout(later, wait - last); | ||
} else { | ||
timeout = null; | ||
if (!immediate) { | ||
result = func.apply(context, args); | ||
context = args = null; | ||
} | ||
} | ||
}; | ||
var debounced = function(){ | ||
context = this; | ||
args = arguments; | ||
timestamp = Date.now(); | ||
var callNow = immediate && !timeout; | ||
if (!timeout) timeout = setTimeout(later, wait); | ||
if (callNow) { | ||
result = func.apply(context, args); | ||
context = args = null; | ||
} | ||
return result; | ||
}; | ||
debounced.clear = function() { | ||
if (timeout) { | ||
clearTimeout(timeout); | ||
timeout = null; | ||
} | ||
}; | ||
return debounced; | ||
}; | ||
/***/ }) | ||
@@ -237,0 +307,0 @@ /******/ ]); |
@@ -1,1 +0,1 @@ | ||
!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Kapsule=t():n.Kapsule=t()}(this,function(){return function(n){function t(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return n[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var e={};return t.m=n,t.c=e,t.d=function(n,e,o){t.o(n,e)||Object.defineProperty(n,e,{configurable:!1,enumerable:!0,get:o})},t.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,"a",e),e},t.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},t.p="",t(t.s=0)}([function(n,t,e){var o,r,i;!function(e,a){r=[n,t],void 0!==(i="function"==typeof(o=a)?o.apply(t,r):o)&&(n.exports=i)}(0,function(n,t){"use strict";function e(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(n){var t=n.stateInit,e=void 0===t?{}:t,r=n.props,i=void 0===r?{}:r,a=n.methods,u=void 0===a?{}:a,c=n.init,f=void 0===c?function(){}:c,l=n.update,d=void 0===l?function(){}:l,s=Object.keys(i).map(function(n){return new o(n,i[n])});return function(){function n(e){return t(e,r),o(),n}function t(t,e){f.call(n,t,i,e),i.initialised=!0}function o(){i.initialised&&d.call(n,i)}var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=Object.assign({},e,{initialised:!1,_rerender:o});return s.forEach(function(t){n[t.name]=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(n,t){};return function(a){return arguments.length?(i[t]=a,r.call(n,a,i),e&&o(),n):i[t]}}(t.name,t.triggerUpdate,t.onChange),i[t.name]=t.defaultVal,t.onChange.call(n,t.defaultVal,i)}),Object.keys(u).forEach(function(t){n[t]=function(){for(var e,o=arguments.length,r=Array(o),a=0;a<o;a++)r[a]=arguments[a];return(e=u[t]).call.apply(e,[n,i].concat(r))}}),n.resetProps=function(){return s.forEach(function(t){i[t.name]=t.defaultVal,t.onChange.call(n,t.defaultVal,i)}),o(),n},n}};var o=function n(t,o){var r=o.default,i=void 0===r?null:r,a=o.triggerUpdate,u=void 0===a||a,c=o.onChange,f=void 0===c?function(n,t){}:c;e(this,n),this.name=t,this.defaultVal=i,this.triggerUpdate=u,this.onChange=f};n.exports=t.default})}])}); | ||
!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Kapsule=t():n.Kapsule=t()}(this,function(){return function(n){function t(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return n[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var e={};return t.m=n,t.c=e,t.d=function(n,e,o){t.o(n,e)||Object.defineProperty(n,e,{configurable:!1,enumerable:!0,get:o})},t.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,"a",e),e},t.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},t.p="",t(t.s=0)}([function(n,t,e){var o,r,i;!function(u,a){r=[n,t,e(1)],void 0!==(i="function"==typeof(o=a)?o.apply(t,r):o)&&(n.exports=i)}(0,function(n,t,e){"use strict";function o(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(n){var t=n.stateInit,e=void 0===t?{}:t,o=n.props,u=void 0===o?{}:o,a=n.methods,l=void 0===a?{}:a,c=n.init,f=void 0===c?function(){}:c,s=n.update,d=void 0===s?function(){}:s,p=Object.keys(u).map(function(n){return new i(n,u[n])});return function(){function n(e){return t(e,o),u(),n}function t(t,e){f.call(n,t,i,e),i.initialised=!0}var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=Object.assign({},e,{initialised:!1,_rerender:u});p.forEach(function(t){n[t.name]=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(n,t){};return function(r){return arguments.length?(i[t]=r,o.call(n,r,i),e&&u(),n):i[t]}}(t.name,t.triggerUpdate,t.onChange),i[t.name]=t.defaultVal,t.onChange.call(n,t.defaultVal,i)}),Object.keys(l).forEach(function(t){n[t]=function(){for(var e,o=arguments.length,r=Array(o),u=0;u<o;u++)r[u]=arguments[u];return(e=l[t]).call.apply(e,[n,i].concat(r))}}),n.resetProps=function(){return p.forEach(function(t){i[t.name]=t.defaultVal,t.onChange.call(n,t.defaultVal,i)}),u(),n};var u=(0,r.default)(function(){i.initialised&&d.call(n,i)},1);return n}};var r=function(n){return n&&n.__esModule?n:{default:n}}(e),i=function n(t,e){var r=e.default,i=void 0===r?null:r,u=e.triggerUpdate,a=void 0===u||u,l=e.onChange,c=void 0===l?function(n,t){}:l;o(this,n),this.name=t,this.defaultVal=i,this.triggerUpdate=a,this.onChange=c};n.exports=t.default})},function(n,t){n.exports=function(n,t,e){function o(){var c=Date.now()-a;c<t&&c>=0?r=setTimeout(o,t-c):(r=null,e||(l=n.apply(u,i),u=i=null))}var r,i,u,a,l;null==t&&(t=100);var c=function(){u=this,i=arguments,a=Date.now();var c=e&&!r;return r||(r=setTimeout(o,t)),c&&(l=n.apply(u,i),u=i=null),l};return c.clear=function(){r&&(clearTimeout(r),r=null)},c}}])}); |
@@ -0,1 +1,3 @@ | ||
import debounce from 'debounce'; | ||
class Prop { | ||
@@ -79,6 +81,6 @@ constructor(name, { default: defaultVal = null, triggerUpdate = true, onChange = (newVal, state) => {}}) { | ||
function digest() { | ||
const digest = debounce(() => { | ||
if (!state.initialised) { return; } | ||
updateFn.call(comp, state); | ||
} | ||
}, 1); | ||
@@ -85,0 +87,0 @@ return comp; |
{ | ||
"name": "kapsule", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "A Simple Web Component library", | ||
@@ -31,3 +31,5 @@ "main": "dist/kapsule.js", | ||
}, | ||
"dependencies": {}, | ||
"dependencies": { | ||
"debounce": "^1.0.2" | ||
}, | ||
"devDependencies": { | ||
@@ -34,0 +36,0 @@ "babel-core": "^6.26.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
196431
20
359
0
1
+ Addeddebounce@^1.0.2
+ Addeddebounce@1.2.1(transitive)