Installation
npm install --save @types/nwmatcher
Summary
This package contains type definitions for nwmatcher (https://github.com/dperini/nwmatcher).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/nwmatcher.
index.d.ts
declare function nwmatcher(global: { document: Document }): nwmatcher.Matcher;
declare namespace nwmatcher {
interface Matcher {
// DOM Selection
first: (selector: string, context?: Element) => Element | null;
match: (element: Element, selector: string, context?: Element) => boolean;
select: (selector: string, context?: Element, callback?: (element: Element) => void) => Element[];
// DOM Helpers
byId: (id: string, from?: Element) => Element | null;
byTag: (tag: string, from?: Element) => Element[];
byClass: (className: string, from?: Element) => Element[];
byName: (name: string, from?: Element) => Element[];
getAttribute: (element: Element, attribute: string) => string | undefined;
hasAttribute: (element: Element, attribute: string) => boolean;
}
}
declare global {
namespace NW {
const Dom: nwmatcher.Matcher;
}
}
export = nwmatcher;
Additional Details
- Last updated: Tue, 07 Nov 2023 0939 GMT
- Dependencies: none
Credits
These definitions were written by Wouter van Heeswijk.