UNPKG

device-navigation

Version:

Navigate HTML elements in two dimensions with non-pointer devices.

22 lines (21 loc) 592 B
import { Directive, directive, extractElement, noChange } from 'element-vir'; /** * Makes arbitrary modifications to the element that its attached to. * * @category Internal */ export const modifyElement = directive(class extends Directive { element; lastKey; constructor(partInfo) { super(partInfo); this.element = extractElement(partInfo, 'modifyElement'); } render(renderKey, callback) { if (renderKey !== this.lastKey) { callback(this.element); this.lastKey = renderKey; } return noChange; } });