@sankhyalabs/core 2.4.2 → 2.5.0
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/.docs/classes/JSUtils.md +46 -0
- package/.docs/modules.md +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/JSUtils.d.ts +14 -0
- package/dist/utils/JSUtils.js +21 -0
- package/dist/utils/JSUtils.js.map +1 -0
- package/package.json +1 -1
- package/src/index.ts +3 -1
- package/src/utils/JSUtils.ts +21 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
[@sankhyalabs/core](../README.md) / [Exports](../modules.md) / JSUtils
|
|
2
|
+
|
|
3
|
+
# Class: JSUtils
|
|
4
|
+
|
|
5
|
+
Classe com utiliários comuns para funções genéricas em JavaScript.
|
|
6
|
+
|
|
7
|
+
## Table of contents
|
|
8
|
+
|
|
9
|
+
### Constructors
|
|
10
|
+
|
|
11
|
+
- [constructor](JSUtils.md#constructor)
|
|
12
|
+
|
|
13
|
+
### Methods
|
|
14
|
+
|
|
15
|
+
- [debounce](JSUtils.md#debounce)
|
|
16
|
+
|
|
17
|
+
## Constructors
|
|
18
|
+
|
|
19
|
+
### constructor
|
|
20
|
+
|
|
21
|
+
• **new JSUtils**()
|
|
22
|
+
|
|
23
|
+
## Methods
|
|
24
|
+
|
|
25
|
+
### debounce
|
|
26
|
+
|
|
27
|
+
▸ `Static` **debounce**(`callback`, `timeout?`): `any`
|
|
28
|
+
|
|
29
|
+
Método responsável em criar um timer para processar uma determinada função.
|
|
30
|
+
|
|
31
|
+
#### Parameters
|
|
32
|
+
|
|
33
|
+
| Name | Type | Default value | Description |
|
|
34
|
+
| :------ | :------ | :------ | :------ |
|
|
35
|
+
| `callback` | `any` | `undefined` | Função de callback para processar após o timer. |
|
|
36
|
+
| `timeout` | `number` | `300` | Valor dos milissegundos desejados para processar a função (o padrão é 300). |
|
|
37
|
+
|
|
38
|
+
#### Returns
|
|
39
|
+
|
|
40
|
+
`any`
|
|
41
|
+
|
|
42
|
+
- Retorna um método com controle de timer para processar a função de callback.
|
|
43
|
+
|
|
44
|
+
#### Defined in
|
|
45
|
+
|
|
46
|
+
src/utils/JSUtils.ts:14
|
package/.docs/modules.md
CHANGED
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
- [ErrorTracking](classes/ErrorTracking.md)
|
|
32
32
|
- [FloatingManager](classes/FloatingManager.md)
|
|
33
33
|
- [HttpProvider](classes/HttpProvider.md)
|
|
34
|
+
- [JSUtils](classes/JSUtils.md)
|
|
34
35
|
- [MaskFormatter](classes/MaskFormatter-1.md)
|
|
35
36
|
- [NumberUtils](classes/NumberUtils.md)
|
|
36
37
|
- [ObjectUtils](classes/ObjectUtils.md)
|
package/dist/index.d.ts
CHANGED
|
@@ -25,4 +25,5 @@ import { LoadDataRequest } from "./dataunit/loading/LoadDataRequest.js";
|
|
|
25
25
|
import { LoadDataResponse } from "./dataunit/loading/LoadDataResponse.js";
|
|
26
26
|
import { ElementIDUtils, IElementIDInfo } from "./utils/ElementIDUtils.js";
|
|
27
27
|
import { UserAgentUtils } from "./utils/UserAgentUtils/index.js";
|
|
28
|
-
|
|
28
|
+
import { JSUtils } from "./utils/JSUtils.js";
|
|
29
|
+
export { StringUtils, MaskFormatter, NumberUtils, FloatingManager, DateUtils, ArrayUtils, TimeFormatter, SkwHttpProvider, HttpProvider, RequestMetadata, AuthorizedServiceCaller, DataUnit, Record, SavedRecord, DataType, UnitMetadata, FieldDescriptor, UserInterface, DependencyType, DataUnitAction, Action, Change, Sort, Filter, ChangeOperation, DUActionInterceptor, ApplicationContext, WaitingChange, PageRequest, QuickFilter, ReadyUtil, ObjectUtils, WarningException, WaitingChangeException, ErrorException, ErrorTracking, ExecutionContext, PaginationInfo, SortingProvider, SortMode, LoadDataRequest, LoadDataResponse, ElementIDUtils, IElementIDInfo, UserAgentUtils, JSUtils };
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,7 @@ import ErrorException from "./exceptions/ErrorException.js";
|
|
|
22
22
|
import { ErrorTracking } from "./traking/ErrorTraking.js";
|
|
23
23
|
import { ElementIDUtils } from "./utils/ElementIDUtils.js";
|
|
24
24
|
import { UserAgentUtils } from "./utils/UserAgentUtils/index.js";
|
|
25
|
+
import { JSUtils } from "./utils/JSUtils.js";
|
|
25
26
|
/*Classes públicas no pacote*/
|
|
26
|
-
export { StringUtils, MaskFormatter, NumberUtils, FloatingManager, DateUtils, ArrayUtils, TimeFormatter, SkwHttpProvider, HttpProvider, RequestMetadata, AuthorizedServiceCaller, DataUnit, DataType, UserInterface, DependencyType, DataUnitAction, Action, Change, ChangeOperation, ApplicationContext, ReadyUtil, ObjectUtils, WarningException, WaitingChangeException, ErrorException, ErrorTracking, SortMode, ElementIDUtils, UserAgentUtils };
|
|
27
|
+
export { StringUtils, MaskFormatter, NumberUtils, FloatingManager, DateUtils, ArrayUtils, TimeFormatter, SkwHttpProvider, HttpProvider, RequestMetadata, AuthorizedServiceCaller, DataUnit, DataType, UserInterface, DependencyType, DataUnitAction, Action, Change, ChangeOperation, ApplicationContext, ReadyUtil, ObjectUtils, WarningException, WaitingChangeException, ErrorException, ErrorTracking, SortMode, ElementIDUtils, UserAgentUtils, JSUtils };
|
|
27
28
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,eAAe,MAAM,yBAAyB,CAAC;AACtD,OAAO,SAAS,MAAM,sBAAsB,CAAC;AAC7C,OAAO,UAAU,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,aAAa,EA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EAGN,eAAe,EAEf,kBAAkB,EAIlB,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,EACd,aAAa,EAIb,QAAQ,EAGR,cAAc,EAEd,cAAc,EACd,OAAO,EACV,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classe com utiliários comuns para funções genéricas em JavaScript.
|
|
3
|
+
*/
|
|
4
|
+
export declare class JSUtils {
|
|
5
|
+
/**
|
|
6
|
+
* Método responsável em criar um timer para processar uma determinada função.
|
|
7
|
+
*
|
|
8
|
+
* @param callback - Função de callback para processar após o timer.
|
|
9
|
+
* @param timeout - Valor dos milissegundos desejados para processar a função (o padrão é 300).
|
|
10
|
+
*
|
|
11
|
+
* @returns - Retorna um método com controle de timer para processar a função de callback.
|
|
12
|
+
*/
|
|
13
|
+
static debounce(callback: any, timeout?: number): any;
|
|
14
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classe com utiliários comuns para funções genéricas em JavaScript.
|
|
3
|
+
*/
|
|
4
|
+
export class JSUtils {
|
|
5
|
+
/**
|
|
6
|
+
* Método responsável em criar um timer para processar uma determinada função.
|
|
7
|
+
*
|
|
8
|
+
* @param callback - Função de callback para processar após o timer.
|
|
9
|
+
* @param timeout - Valor dos milissegundos desejados para processar a função (o padrão é 300).
|
|
10
|
+
*
|
|
11
|
+
* @returns - Retorna um método com controle de timer para processar a função de callback.
|
|
12
|
+
*/
|
|
13
|
+
static debounce(callback, timeout = 300) {
|
|
14
|
+
let timer;
|
|
15
|
+
return (...args) => {
|
|
16
|
+
clearTimeout(timer);
|
|
17
|
+
timer = setTimeout(() => { callback.apply(this, args); }, timeout);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=JSUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JSUtils.js","sourceRoot":"","sources":["../../src/utils/JSUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,OAAO;IAElB;;;;;;;OAOG;IACI,MAAM,CAAC,QAAQ,CAAC,QAAa,EAAE,UAAkB,GAAG;QACvD,IAAI,KAAU,CAAC;QACf,OAAO,CAAC,GAAG,IAAS,EAAE,EAAE;YACtB,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QACrE,CAAC,CAAC;IACN,CAAC;CACF"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -25,6 +25,7 @@ import { LoadDataRequest } from "./dataunit/loading/LoadDataRequest.js";
|
|
|
25
25
|
import { LoadDataResponse } from "./dataunit/loading/LoadDataResponse.js";
|
|
26
26
|
import { ElementIDUtils, IElementIDInfo } from "./utils/ElementIDUtils.js";
|
|
27
27
|
import { UserAgentUtils } from "./utils/UserAgentUtils/index.js";
|
|
28
|
+
import { JSUtils } from "./utils/JSUtils.js";
|
|
28
29
|
|
|
29
30
|
/*Classes públicas no pacote*/
|
|
30
31
|
export {
|
|
@@ -72,5 +73,6 @@ export {
|
|
|
72
73
|
LoadDataResponse,
|
|
73
74
|
ElementIDUtils,
|
|
74
75
|
IElementIDInfo,
|
|
75
|
-
UserAgentUtils
|
|
76
|
+
UserAgentUtils,
|
|
77
|
+
JSUtils
|
|
76
78
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classe com utiliários comuns para funções genéricas em JavaScript.
|
|
3
|
+
*/
|
|
4
|
+
export class JSUtils{
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Método responsável em criar um timer para processar uma determinada função.
|
|
8
|
+
*
|
|
9
|
+
* @param callback - Função de callback para processar após o timer.
|
|
10
|
+
* @param timeout - Valor dos milissegundos desejados para processar a função (o padrão é 300).
|
|
11
|
+
*
|
|
12
|
+
* @returns - Retorna um método com controle de timer para processar a função de callback.
|
|
13
|
+
*/
|
|
14
|
+
public static debounce(callback: any, timeout: number = 300): any {
|
|
15
|
+
let timer: any;
|
|
16
|
+
return (...args: any) => {
|
|
17
|
+
clearTimeout(timer);
|
|
18
|
+
timer = setTimeout(() => { callback.apply(this, args); }, timeout);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|