1.2.0 • Published 4 years ago

lfutils v1.2.0

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
4 years ago

LFUtils

This is a group of functionalities to easy handling of BROWSERS. for Node JS... test the functionality 😬, without compromises!

LICENSE

MIT

OPTIONS

Cacher

The plan is apply cache to every GET request, using XHRRequest. In the request obtain pure response an add it to cache system. Works fine with indexedDB (And is the recomended). We have the functions:

get: (endpoint, headers, cacheFirst, cacheSystem, objectToRequest) put: (endpoint, data, headers, cacheFirst, cacheSystem, objectToRequest) patch: (endpoint, data, headers, cacheFirst, cacheSystem, objectToRequest) post: (endpoint, data, headers, cacheFirst, cacheSystem, objectToRequest) delete: (endpoint, headers, cacheFirst, cacheSystem, objectToRequest) options: (endpoint, headers, cacheFirst, cacheSystem, objectToRequest) head: (endpoint, headers, cacheFirst, cacheSystem, objectToRequest)

Props: endpoint => String of URL of the request headers => Object of request headers

The system mantain the cache if it is required. If a cache isnt required, the system mantain cache op to 24 hours. After, the cache is deleted. The time to mantain de cache can be setted with variable: window.mediaCache. The format is number. The number indicates the time, in hours, to mantain the cache

The functions works like this:

import { cacher } from 'lfutils';

...

cacher.get(/* Params */).then(dt => { /* Actions */ });

Timer

Timer require initialization.

import { Timer } from 'lfutils';

...

Timer.initModule();

To start timer

import { Timer } from 'lfutils';
Timer.initModule();

...

let identificator = Timer.add(() => { ... }, 1000, true); // Time in number, true or false for recursive

For finish timer

import { Timer } from 'lfutils';
Timer.initModule();

...

Timer.remove(identificator);
1.2.0

4 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago