@appstractdk/as-core
v1.1.18
Published
as-core contains the base for most of our components, i.e. `Base` and `View` components. This packages contains no styling.
Downloads
26
Keywords
Readme
as-core
as-core contains the base for most of our components, i.e. Base
and View
components.
This packages contains no styling.
Base
Base class contains the following methods:
makeElement(name[, attributes])
- creates HTML element specified bytagName
with optional attributes.const node = this.makeElement('div', 'test-class');
- creates an element with a class passed as a string.const node = this.makeElement('div', 'test-class another-test-class third-class');
- creates an element with several classes passed as a string.className: 'test-class', }, [ this.makeElement('a', { innerHTML: 'text', href: 'https://google.com' }) ]);``` - creates an element with a child.
xmlns: 'http://www.w3.org/1999/xhtml', className: 'test-class another-test-class' });``` - creates an element with custom namespace.
matches(element, selector)
- Element.matches() polyfill.subscribe(eventName, listener, context)
- subscribe to an event.emit(eventName, ...arg)
- emit on an event.
View
View class contains the following methods:
query(selectors)
- returns an array of all elements descended from the selector.addListener(type, match, method)
- adds an event listener to specified listener.remove()
- removes the element.