Skip to content

Latest commit

 

History

History
86 lines (58 loc) · 5.93 KB

File metadata and controls

86 lines (58 loc) · 5.93 KB

Yamato Daiwa E(CMA)S(cript) Extensions [YDEE] - BrowserJS

npm GitHub MIT TypeScript IntelliJ IDEA plugin

NPM Version No any type No third-party dependencies

GitHub Sponsors PAYPAL LIBERAPAY

Additional to @yamato-daiwa/es-extensions functionality for the browser environment.

Helper functions and classes aimed to reduce the routine code. Build-in TypeScript type safety without any type. Oriented to TypeScript users investing the time to quality including type-safety.

Installation

npm i @yamato-daiwa/es-extensions-browserjs @yamato-daiwa/es-extensions -E

Please install the same versions of the above dependencies.

Documentation

DOM Manipulations

cloneDOM_Element
Clones target DOM element herewith takes care about dealing with correct typing of a cloned element. It is required to explicitly specify must children nodes be cloned at once.
createDOM_ElementFromHTML_Code
Creates the DOM element (Element) or it's inheritor from HTML code, herewith it must be exactly one root element.
createHTML_CollectionFromHTML_Code
Creates the HTMLCollection from HTML code passed as parameter.
getExpectedToBeSingleChildOfTemplateElement
Retrieves the child (of Element type or specified subtype) of template element if this child is exactly one, otherwise throws the error.
getExpectedToBeSingleDOM_Element
Retrieves the element corresponding to specified selector if this element presents in single instance inside specific context, otherwise throws the error.

Events handling

addLeftClickEventHandler
Adds on mouse left click event handler. The main difference with native analogues is addLeftClickEventHandler provides the instance of MouseEvent, not generic Event that is critical for TypeScript.
delegateClickEventHandling
Creates just one click event listener while allowing to handle the click of arbitrary large number of elements what is the optimization measures.

Logging

BasicFrontEndLogger
The implementation of ILogger interface for the Logger facade which could be used as the base of the custom implementation for the frontend side of the websites / web application.