• Version 2.4.4
  • Published
  • 9.41 kB
  • 2 dependencies
  • MIT license


npm i @types/watchpack
yarn add @types/watchpack
pnpm add @types/watchpack


TypeScript definitions for watchpack



class Watchpack

class Watchpack extends EventEmitter {}


    constructor(options: Watchpack.WatchOptions);

      property aggregatedChanges

      aggregatedChanges: Set<string>;

        property aggregatedRemovals

        aggregatedRemovals: Set<string>;

          property aggregateTimeout

          aggregateTimeout: NodeJS.Timer;

            property dirWatchers

            dirWatchers: Watcher[];

              property fileWatchers

              fileWatchers: Watcher[];

                property mtimes

                mtimes: { [path: string]: number };
                • Last modified times for files by path

                property options

                options: Watchpack.WatchOptions;

                  property paused

                  paused: boolean;

                    property watcherOptions

                    watcherOptions: Watchpack.WatcherOptions;

                      method close

                      close: () => void;
                      • Stops emitting events and closes all watchers

                      method collectTimeInfoEntries

                      collectTimeInfoEntries: (
                      fileInfoEntries: Map<string, Entry>,
                      directoryInfoEntries: Map<string, Entry>
                      ) => void;
                      • Collects time info objects for all known files and directories This includes info from files not directly watched

                      method getAggregated

                      getAggregated: () => { changes: Set<string>; removals: Set<string> };
                      • Returns the current aggregated info and removes that from the watcher The next aggregated event won't include that info and will only emitted when futher changes happen Can be used when paused

                      method getTimeInfoEntries

                      getTimeInfoEntries: () => Map<string, Entry>;
                      • Returns a Map with all known time info objects for files and directories Similar to collectTimeInfoEntries() but returns a single map with all entries

                      method getTimes

                      getTimes: () => { [path: string]: number };
                      • Returns an object with all known change times for files This include timestamps from files not directly watched Key: absolute path, value: timestamp as number


                      method on

                      on: {
                      eventName: 'change',
                      listener: (
                      filePath: string,
                      modifiedTime: number,
                      explanation: string
                      ) => void
                      ): this;
                      eventName: 'remove',
                      listener: (filePath: string, explanation: string) => void
                      ): this;
                      eventName: 'aggregated',
                      listener: (changes: Set<string>, removals: Set<string>) => void
                      ): this;

                        method pause

                        pause: () => void;
                        • Stops emitting events, but keeps watchers open The next "watch" call can reuse the watchers The watcher will keep aggregating events which can be received with getAggregated()

                        method watch

                        watch: (options: {
                        files?: Iterable<string>;
                        directories?: Iterable<string>;
                        missing?: Iterable<string>;
                        startTime?: number;
                        }) => void;
                        • Starts watching these files and directories Calling this again will override the files and directories


                        interface WatcherOptions

                        interface WatcherOptions {}
                          followSymlinks?: boolean;

                            property ignored

                            ignored?: string[] | string | RegExp | ((path: string) => boolean) | undefined;

                              property poll

                              poll?: boolean | number | undefined;

                                interface WatchOptions

                                interface WatchOptions extends WatcherOptions {}

                                  property aggregateTimeout

                                  aggregateTimeout?: number | undefined;

                                    Package Files (1)

                                    Dependencies (2)

                                    Dev Dependencies (0)

                                    No dev dependencies.

                                    Peer Dependencies (0)

                                    No peer dependencies.


                                    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/watchpack.

                                    • Markdown
                                    • HTML
                                      <a href="https://www.jsdocs.io/package/@types/watchpack"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>