UNPKG

896 BTypeScriptView Raw
1/**
2 * Copyright (c) 2017, Philip Walton <philip@philipwalton.com>
3 */
4/**
5 * Delegates the handling of events for an element matching a selector to an
6 * ancestor of the matching element.
7 * @param {!Node} ancestor The ancestor element to add the listener to.
8 * @param {string} eventType The event type to listen to.
9 * @param {string} selector A CSS selector to match against child elements.
10 * @param {!Function} callback A function to run any time the event happens.
11 * @param {Object=} opts A configuration options object. The available options:
12 * - useCapture<boolean>: If true, bind to the event capture phase.
13 * - deep<boolean>: If true, delegate into shadow trees.
14 * @return {Object} The delegate object. It contains a destroy method.
15 */
16export declare function delegate(ancestor: any, eventType: any, selector: any, callback: any, opts?: {}): {
17 destroy: () => void;
18};