Events

Dubnium uses the built-in Events module to send messages when something happens!

Event
Callback Arguments
About

start

Directory path & file extension

Fires when Dubnium is initialized.

create

Tag & content

Fires when a Record is created.

delete

Tag & content

Fires when a Record is deleted.

edit

Tag, old & new content

Fires when a Record's value changes.

retagged

Old & new tag

Fires when a Record's tag changes.

wipe

Directory path

Fires when the database is wiped.

close

Directory path

Fires when the database is closed.

delete_old

Options

Fires when deleteOld is called. (Will also fire delete for any Records deleted)

dir

Directroy path

Fires when the directory is created.

move

Tag, old & new directory

Fires when a Record is moved.

clone

Tag, target

Fires when a Record is cloned.

symlink

Tag & path to symlink

Fires when a Symlink is created.

sync

Tag & tag of synced with

Fires when syncWith is called.

delete_large

Options

Fires when deleteLarge() is called.

append

Tag, content

Fires when content is appended.

truncate

Tag, length

Fires when a Record is truncated.

fs

Function, tag, args

Fires when fs() is called.

beautify

Tag, replacer, space

Fires when JSON is beautified.

exec

Command & callback

Fires when a bash command is ran via db.exec().

save

Tag & content

Fires when a record is saved. This will also fire the edit event.

stop_versioning

Options

Fires when you stop recording versions.

empty

Record tag

Fires when a Record is emptied.

Any events from fs.watch() will be fired if versioning is enabled.

Example

db.on('create', (tag, content) => { console.log(`${tag} was created!`) })

Last updated