mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 15:27:05 +00:00
[nedb] Nedb class should extend EventEmitter (#31669)
This commit is contained in:
committed by
Wesley Wigham
parent
9e661f99a8
commit
e8cd4c9394
Vendored
+16
-1
@@ -5,10 +5,14 @@
|
||||
// Alejandro Fernandez Haro <https://github.com/afharo>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
export = Nedb;
|
||||
export as namespace Nedb;
|
||||
|
||||
declare class Nedb {
|
||||
declare class Nedb extends EventEmitter {
|
||||
constructor(pathOrOptions?: string | Nedb.DataStoreOptions);
|
||||
|
||||
persistence: Nedb.Persistence;
|
||||
@@ -153,6 +157,17 @@ declare class Nedb {
|
||||
*/
|
||||
remove(query: any, options: Nedb.RemoveOptions, cb?: (err: Error, n: number) => void): void;
|
||||
remove(query: any, cb?: (err: Error, n: number) => void): void;
|
||||
|
||||
addListener(event: 'compaction.done', listener: () => void): this;
|
||||
on(event: 'compaction.done', listener: () => void): this;
|
||||
once(event: 'compaction.done', listener: () => void): this;
|
||||
prependListener(event: 'compaction.done', listener: () => void): this;
|
||||
prependOnceListener(event: 'compaction.done', listener: () => void): this;
|
||||
removeListener(event: 'compaction.done', listener: () => void): this;
|
||||
off(event: 'compaction.done', listener: () => void): this;
|
||||
listeners(event: 'compaction.done'): Array<() => void>;
|
||||
rawListeners(event: 'compaction.done'): Array<() => void>;
|
||||
listenerCount(type: 'compaction.done'): number;
|
||||
}
|
||||
|
||||
declare namespace Nedb {
|
||||
|
||||
@@ -514,3 +514,14 @@ db.insert({ somefield: 'nedb' }, (err: Error) => {
|
||||
// Remove index on field somefield
|
||||
db.removeIndex('somefield', (err: Error) => {
|
||||
});
|
||||
|
||||
db.addListener("compaction.done", () => {});
|
||||
db.on("compaction.done", () => {});
|
||||
db.once("compaction.done", () => {});
|
||||
db.prependListener("compaction.done", () => {});
|
||||
db.prependOnceListener("compaction.done", () => {});
|
||||
db.removeListener("compaction.done", () => {});
|
||||
db.off("compaction.done", () => {});
|
||||
db.listeners("compaction.done"); // $ExpectType (() => void)[]
|
||||
db.rawListeners("compaction.done"); // $ExpectType (() => void)[]
|
||||
db.listenerCount("compaction.done"); // $ExpectType number
|
||||
|
||||
Reference in New Issue
Block a user