native-document 1.0.259 → 1.0.261

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.
package/index.js CHANGED
@@ -8,8 +8,8 @@ export { SingletonView, useSingleton } from './src/core/wrappers/SingletonView';
8
8
  export { default as PluginsManager } from './src/core/utils/plugins-manager';
9
9
  export { default as Validator } from './src/core/utils/validator';
10
10
 
11
- export { Formatters } from "./src/core/utils/formatters";
12
- export {default as ShortcutManager} from "./src/core/utils/shortcut-manager";
11
+ export { Formatters } from './src/core/utils/formatters';
12
+ export {default as ShortcutManager} from './src/core/utils/shortcut-manager';
13
13
 
14
14
  export * from './src/core/utils/property-accumulator';
15
15
  export * from './src/core/utils/args-types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-document",
3
- "version": "1.0.259",
3
+ "version": "1.0.261",
4
4
  "description": "A reactive JavaScript framework that preserves native DOM simplicity without sacrificing modern features",
5
5
  "author": "AfroCodeur <https://github.com/afrocodeur>",
6
6
  "license": "MIT",
@@ -141,4 +141,21 @@ export const deepClone = (value, onObservableFound) => {
141
141
  }
142
142
  }
143
143
  return cloned;
144
+ };
145
+
146
+
147
+ export const lock = (fn, defaultReturn) => {
148
+ let isLocked = false;
149
+
150
+ return async (...args) => {
151
+ if(isLocked) {
152
+ return typeof defaultReturn === 'function' ? defaultReturn() : defaultReturn;
153
+ }
154
+ isLocked = true;
155
+ try {
156
+ return await fn(...args);
157
+ } finally {
158
+ isLocked = false;
159
+ }
160
+ };
144
161
  };
@@ -0,0 +1,7 @@
1
+
2
+
3
+
4
+ export declare const lock: <TArgs extends any[], TResult, TDefault = undefined>(
5
+ fn: (...args: TArgs) => Promise<TResult> | TResult,
6
+ defaultReturn?: TDefault | (() => TDefault)
7
+ ) => (...args: TArgs) => Promise<TResult | TDefault>;
package/utils.d.ts CHANGED
@@ -2,4 +2,5 @@
2
2
  export * from './types/native-fetch';
3
3
  export * from './types/service';
4
4
  export * as filters from './types/filters/index';
5
- export * from './types/localStorage'
5
+ export * from './types/localStorage'
6
+ export * from './types/helpers';
package/utils.js CHANGED
@@ -4,6 +4,8 @@ import * as filters from './src/core/utils/filters/index';
4
4
  import {classPropertyAccumulator, cssPropertyAccumulator} from './src/core/utils/property-accumulator';
5
5
  import {LocalStorage} from './src/core/utils/localstorage';
6
6
 
7
+ export * from './src/core/utils/helpers';
8
+
7
9
  const Service = Cache;
8
10
 
9
11
  export {