Skip to content

Latest commit

 

History

History
77 lines (43 loc) · 3.27 KB

README.md

File metadata and controls

77 lines (43 loc) · 3.27 KB

ESL Utils

ESL Utils - is a module that contains a set of common utilities for working with DOM, BOM and other simple but handy things that are used by ESL components, but can also be used in client code.

All ESL Utils helpers are super simple and atomic, be sure that none of the utilities requires the whole library. Even if you use the whole utils module, it is still tiny.


Modules

  • Abstract

    • Observable - small base class that implements observable pattern.

  • Async

    • Debounce - debounce function decorator.

      Debouncing is a pattern commonly used for rate limiting function calls with a timeout.

    • Delayed Task - common helper to plan task (function) to be executed with or without a timeout.

      New task planning request cancels the previous task in a DelayedTask instance in case it has not happened yet.

    • Promise Utils - a set of Promise helpers.

      Allows converting DOM Events, timeouts, pooling check, etc. to ES6 Promise or create a Deferred object that allows to resolve or reject related Promise.

    • RAF(Rendering callback) Utils - Request Animation Frame common helpers.

      Includes RAF Decorator that postpones multiple function calls to a single one before rendering. Also includes afterNextRender deferring function.

    • Throttle - throttling function decorator.

      Throttling is a pattern that allows to limit function call to one execution per timeout.

  • TS Decorators

    • @bind - TS decorator to bind method context to current class instance.

    • @memoize - TS decorator to make method or get accessor memoized.

    • @prop - TS decorator to define a field on the prototype level.

  • DOM Helpers

    • Keys - keyboard keys constants.

    • RTL Utils - Utils to detect RTL and RTL-specific browsers behavior.

    • Scripts - script loading utility to limit and track loading.

    • Scroll - scroll locking methods.

      Note: uses scroll.less styles.

    • CSSClass - is a utility to work with CSS classes. Supports JQuery-like enumeration, inversion syntax and locks.

    • DOM Traversing - a set of utils to find DOM elements or check their relations.

  • Environment

    • Device Detector - set of user agent based checks such as engine or device type.

  • Miscellaneous Utils

    • Array - array utils (uniq, flat, wrap, etc.).

    • Format - string format utils.

    • Function - simple functions and types.

    • Memoize - memoization function decorator.

      Memoization patten allows executing pure function once and then use the cached result.

    • Object - object common utils.

    • UID - unique identifier generation util.