import { PromiseOrValue, GenericConstructor } from "./interfaces"; import DojoPromise = require("./promise/Promise"); declare namespace dojoParser { interface ParserOptions { } interface ParserObjects { ctor?: GenericConstructor; types?: string[]; node: Node; scripts?: HTMLScriptElement[]; inherited?: { [prop: string]: any; }; } interface InstancesArray extends Array, DojoPromise {} interface Parser { /** * Clear cached data. Used mainly for benchmarking. */ _clearCache(): void; /** * Convert a `` * into a function */ _functionFromScript(node: HTMLScriptElement, attrData: string): Function; /** * Takes array of nodes, and turns them into class instances and * potentially calls a startup method to allow them to connect with * any children. */ instantiate(nodes: Node[], mixin?: Object, options?: ParserOptions): any[]; /** * Takes array of objects representing nodes, and turns them into class instances and * potentially calls a startup method to allow them to connect with * any children. */ _instantiate(nodes: ParserObjects[], mixin?: Object, options?: ParserOptions, returnPromise?: boolean): PromiseOrValue; /** * Calls new ctor(params, node), where params is the hash of parameters specified on the node, * excluding data-dojo-type and data-dojo-mixins. Does not call startup(). */ construct( ctor: GenericConstructor, node: Node, mixin?: Object, options?: ParserOptions, scripts?: HTMLScriptElement[], inherited?: { [prop: string]: any; } ): PromiseOrValue; /** * Scan a DOM tree and return an array of objects representing the DOMNodes * that need to be turned into widgets. */ scan(root?: Node, options?: ParserOptions): DojoPromise; /** * Helper for _scanAMD(). Takes a `` node, * calls require() to load the specified modules and (asynchronously) assign them to the specified global * variables, and returns a Promise for when that operation completes. * * In the example above, it is effectively doing a require(["acme/bar", ...], function(a){ bar = a; }). */ _require(script: HTMLScriptElement, options: ParserOptions): DojoPromise; /** * Scans the DOM for any declarative requires and returns their values. */ _scanAmd(root?: Node, options?: ParserOptions): DojoPromise; /** * Scan the DOM for class instances, and instantiate them. */ parse(rootNode?: Node, options?: ParserOptions): InstancesArray; } } declare const dojoParser: dojoParser.Parser; export = dojoParser;