neo.mjs 6.5.4 → 6.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='6.5.4'
23
+ * @member {String} version='6.5.5'
24
24
  */
25
- version: '6.5.4'
25
+ version: '6.5.5'
26
26
  }
27
27
 
28
28
  /**
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='6.5.4'
23
+ * @member {String} version='6.5.5'
24
24
  */
25
- version: '6.5.4'
25
+ version: '6.5.5'
26
26
  }
27
27
 
28
28
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "6.5.4",
3
+ "version": "6.5.5",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -236,12 +236,12 @@ const DefaultConfig = {
236
236
  useVdomWorker: true,
237
237
  /**
238
238
  * buildScripts/injectPackageVersion.mjs will update this value
239
- * @default '6.5.4'
239
+ * @default '6.5.5'
240
240
  * @memberOf! module:Neo
241
241
  * @name config.version
242
242
  * @type String
243
243
  */
244
- version: '6.5.4'
244
+ version: '6.5.5'
245
245
  };
246
246
 
247
247
  Object.assign(DefaultConfig, {
@@ -17,17 +17,6 @@ class Text extends Base {
17
17
  * @static
18
18
  */
19
19
  static autoCapitalizeValues = ['characters', 'none', 'on', 'off', 'sentences', 'words']
20
- /**
21
- * @member {Object} delayable
22
- * @protected
23
- * @static
24
- */
25
- static delayable = {
26
- fireChangeEvent: {
27
- type : 'debounce',
28
- timer: 300
29
- }
30
- }
31
20
  /**
32
21
  * Valid values for labelPosition
33
22
  * @member {String[]} labelPositions=['bottom','inline','left','right','top']
@@ -99,16 +99,25 @@ export function intercept(target, targetMethodName, interceptFunction, scope, pr
99
99
  * @returns {Function}
100
100
  */
101
101
  export function throttle(callback, scope, delay=300) {
102
- let wait = false;
102
+ let lastRanDate, timeoutId;
103
103
 
104
104
  return function(...args) {
105
- if (!wait) {
106
- wait = true;
107
-
105
+ if (!lastRanDate) {
108
106
  // we need to check if the scope (instance) did not get destroyed yet
109
107
  scope?.id && callback.apply(scope, args);
110
108
 
111
- setTimeout(() => {wait = false}, delay)
109
+ lastRanDate = Date.now()
110
+ } else {
111
+ clearTimeout(timeoutId)
112
+
113
+ timeoutId = setTimeout(function() {
114
+ if ((Date.now() - lastRanDate) >= delay) {
115
+ // we need to check if the scope (instance) did not get destroyed yet
116
+ scope?.id && callback.apply(scope, args);
117
+
118
+ lastRanDate = Date.now()
119
+ }
120
+ }, delay - (Date.now() - lastRanDate))
112
121
  }
113
122
  }
114
123
  }