Utils library for JavaScript/TypeScript, so you don't have to reinvent the wheel.
$ npm i -s tlorc
TloEventWrapper:
import {TloEventWrapper} from 'tlorc';
const el = document.getElementById('foo');
const tloEvent = new TloEventWrapper(el);
tloEvent.throttle('scroll', () => {
// code here
});
TloHttp:
import {TloHttp} from 'tlorc';
const http = new TloHttp();
http.get('https://jsonplaceholder.typicode.com/todos/1')
.then(data => console.log(data));
Check https://github.com/tlo-devs/tlorc/wiki/
- [TloEventWrapper] Fixed an issue with debounce
- Moved and extended the documentation (https://github.com/tlo-devs/tlorc/wiki/)
- Fixed method types being displayed as props in the interfaces
- [TloEventWrapper] Changed useCapture to be optional when adding an event with object syntax
- [TloHttp] Fixed issues with PUT/DELETE
- [TloHttp] Added support for Blobs
- [TloHttp] Improved error handling
- Added basic utils to [Tlorc]
- [TloHttp] Added a default Content Type header 'application/json'
- [TloHttp] Added an optional 'headers' parameter to the constructor
- [TloHttp] Added the option to modify instance-level headers via
new TloHttp().headers
- [TloHttp] Fixed a bug with missing body
- [TloEventWrapper] Fixed the bug where callbacks with an argument would need to be undefined checked
- [TloEventWrapper] Added a functionality for all methods - now they all return their instance of
TloEventWrapper
, which allows for method chaining
- Improved types for TloHttp
- Fixed a typing bug with method$Full methods. Now, the return type for them is
Promise<TloFullResponse<T>>
(see docs).
- Added params to TloHttp options
- Fixed types for TloHttp body
- Improved the docs
- Added TloHttp - a fetch http client (see docs for more details)
- Fixed a bug with removing event listeners
- Fixed a bug with
new TloEventWrapper(element)
throwing an error for elements that may be null
- Added
add
anddebounce
instance methods - Changed the event handler's name from TloEvent to TloEventWrapper
- Added the option to set the
useCapture
parameter in TloEventWrapper methods - Added the docs
- Fixed the callback reference
- Fixed the main library path
- Improved type checking
- Added removing event listeners via
tloEvent.remove('eventName')
ortloEvent.removeAll()
.