jodit
Version:
Jodit is an awesome and useful wysiwyg editor with filebrowser
56 lines (55 loc) • 1.97 kB
TypeScript
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module dom
*/
import type { IAsync, IDestructible } from "../../types/index";
import { Eventify } from "../event-emitter/eventify";
/**
* Walks the DOM tree in small chunks between browser tasks so that even huge
* documents do not block the main thread.
*
* Events:
* - `visit` - is called for every node; return `true` to mark the pass as
* "had effect" (it will be passed into the `end` event)
* - `break` - the pass was interrupted via [[LazyWalker.break]]
* - `end` - the pass is finished, receives `true` if some `visit` handler returned `true`
*/
export declare class LazyWalker extends Eventify<{
visit: (node: Node) => boolean;
break: (reason?: string) => void;
end: (affect: boolean) => void;
}> implements IDestructible {
private readonly async;
private readonly options;
private workNodes;
/**
* Starts a new pass over the `root` tree.
* If a previous pass is still running it will be stopped first.
*/
setWork(root: Node): this;
private hadAffect;
private isWorked;
private isFinished;
constructor(async: IAsync, options?: {
/** Visit only nodes with this `nodeType` (e.g. `Node.ELEMENT_NODE`) */
readonly whatToShow?: number;
/** Walk the tree from the last node to the first */
readonly reverse?: boolean;
/** How many nodes are processed per one chunk. Default: 50 */
readonly timeoutChunkSize?: number;
/** Delay between chunks in ms */
readonly timeout?: number;
});
private __schedulerController;
private _requestStarting;
break(reason?: string): void;
end(): void;
private stop;
destruct(): void;
private __workPerform;
private visitNode;
}