powerpagestoolkit
Version:
Reference, manipulate, and engage with Power Pages sites through the nodes in the DOM; use a variety of custom methods that allow customizing your power pages site quicker and easier.
55 lines (54 loc) • 3.09 kB
TypeScript
/// <reference path="../globals.d.ts" />
import type PowerPagesElementArray from "./PowerPagesElementArray.d.ts";
import PowerPagesElement from "./PowerPagesElement.d.ts";
/**
* Creates and initializes a PowerPagesElement instance.
* @see {@link CreationOptions}
* @param **target** - The selector, using `querySelector` syntax, for the desired DOM element. Or, the `HTMLElement` itself for which to create a PowerPagesElement.
* @param **options** - Options for advanced retrieval of elements
* @param **options.multiple** - Should this call return an array of instantiated references, or just a single? Defaults to false, returning a single instance
* @param **options.root** - Optionally specify the element within to search for the element targeted by 'target'. Defaults to `document.body`
* @param **options.timeoutMs** - Optionally specify the amount of time that should be waited to find the targeted element before throwing error - useful for async DOM loading. Relies on MutationObserver. ***WARNING***: Implementing multiple references with timeout can result in infinite loading.
* @returns A promise that resolves to a Proxy of the initialized PowerPagesElement instance.
*
* @see {@link PowerPagesElement}
* @see {@link PowerPagesElementArray}
* @see {@link enhanceArray}
*/
export default function createPowerPagesElement(target: string | Element): Promise<PowerPagesElement>;
export default function createPowerPagesElement(target: Element): Promise<PowerPagesElement>;
export default function createPowerPagesElement(target: string, options?: {
/**
* Optionally specify the element within which to search for the element targeted by 'target'.
* Defaults to 'document.body'.
*/
root?: HTMLElement;
/**
* Optionally specify the amount of time that should be waited to find the targeted element before throwing an error.
* Useful for async DOM loading. Relies on MutationObserver.
* WARNING: Implementing multiple references with timeout can result in infinite loading.
*/
timeoutMs?: number;
}): Promise<PowerPagesElement>;
export default function createPowerPagesElement(target: string, options?: {
/**
* Should this call return an array of instantiated references, or just a single?
* Defaults to false, returning a single instance.
*/
multiple?: true;
/**
* Optionally specify the element within which to search for the element targeted by 'target'.
* Defaults to 'document.body'.
*/
root?: HTMLElement;
/**
* Optionally specify the amount of time that should be waited to find the targeted element before throwing an error.
* Useful for async DOM loading. Relies on MutationObserver.
* WARNING: Implementing multiple references with timeout can result in infinite loading.
*/
timeoutMs?: number;
}): Promise<PowerPagesElementArray>;
export declare function validateOptions(options: Partial<CreationOptions>): void;
export declare function createProxyHandler(): {
get: (target: PowerPagesElement, prop: string | symbol) => any;
};