Skip to content

Class VirtualBase<E>

Source: virtualBase.ts

Extends

Extended by

Type Parameters

E

E extends VirtualBaseEvents = VirtualBaseEvents

Constructors

Constructor

new VirtualBase<E>(name: string): VirtualBase<E>

Parameters

name

string

Returns

VirtualBase<E>

Overrides

EventEmitter<E & Record<keyof E, unknown[]>>.constructor

Properties

name

name: string

The name of this item.


alias

alias: string | null | undefined

The alias of this item.


parent

parent: VirtualFolder<VirtualBaseEvents> | null | undefined

The folder this item is in.


isProtected

isProtected: boolean | null | undefined

Whether this item is protected from changes.


iconUrl

iconUrl: string | null | undefined

The URL of the icon of this item.


linkedFile

linkedFile: VirtualFile | null | undefined

The file this item links to.


linkedFolder

linkedFolder: VirtualFolder<VirtualBaseEvents> | null | undefined

The folder this item links to.


editedByUser

editedByUser: boolean | null | undefined

Whether this item has been edited by the user.


isRoot

isRoot: boolean | null | undefined

Whether this item is the root folder.


root

root: VirtualRoot | null | undefined

The root folder.


isDeleted

isDeleted: boolean

Whether this item has been deleted.


UPDATE_EVENT

readonly static UPDATE_EVENT: "update" = "update"

Methods

setName()

setName(name: string): this

Parameters

name

string

Returns

this


setAlias()

setAlias(alias: string): this

Parameters

alias

string

Returns

this


setParent()

setParent(parent: VirtualFolder): this

Parameters

parent

VirtualFolder

Returns

this


setProtected()

setProtected(value: boolean): this

Parameters

value

boolean

Returns

this


setIconUrl()

setIconUrl(iconUrl: string | null): this

Parameters

iconUrl

string | null

Returns

this


getIconUrl()

getIconUrl(): string

Returns

string


getType()

getType(): string

Returns

string


delete()

delete(): void

Tries to delete this item.

Returns

void


confirmChanges()

confirmChanges(root?: VirtualRoot): void

Parameters

root?

VirtualRoot

Returns

void


open()

open(..._args: unknown[]): unknown

Opens this item in the appropriate application.

Parameters

_args

...unknown[]

Returns

unknown


getRoot()

getRoot(): VirtualRoot

Returns the root folder.

Returns

VirtualRoot


isFile()

isFile(): this is VirtualFile

Returns

this is VirtualFile


isFolder()

isFolder(): this is VirtualFolder<VirtualBaseEvents>

Returns

this is VirtualFolder<VirtualBaseEvents>


toJSON()

toJSON(): VirtualBaseJson | null

Returns

VirtualBaseJson | null


toString()

toString(): string | null

Returns a string representation of an object.

Returns

string | null


on()

on<K>(event: K, listener: Listener<E & Record<keyof E, unknown[]>, K>): Listener<E & Record<keyof E, unknown[]>, K>

Starts listening to an event.

Type Parameters

K

K extends string | number | symbol

Parameters

event

K

The event to listen to.

listener

Listener<E & Record<keyof E, unknown[]>, K>

The function to call when the event is emitted.

Returns

Listener<E & Record<keyof E, unknown[]>, K>

The listener.

Inherited from

EventEmitter.on


once()

once<K>(event: K, listener: Listener<E & Record<keyof E, unknown[]>, K>): Listener<E & Record<keyof E, unknown[]>, K>

Registers an event listener that is automatically removed when called.

Type Parameters

K

K extends string | number | symbol

Parameters

event

K

The event to listen to.

listener

Listener<E & Record<keyof E, unknown[]>, K>

The function to call once the event is emitted.

Returns

Listener<E & Record<keyof E, unknown[]>, K>

The wrapped listener.

Inherited from

EventEmitter.once


onAsync()

onAsync<K>(event: K, listener: AsyncListener<E & Record<keyof E, unknown[]>, K>, onRejected?: (reason: any) => unknown | null): Listener<E & Record<keyof E, unknown[]>, K>

Starts listening to an event.

Type Parameters

K

K extends string | number | symbol

Parameters

event

K

The event to listen to.

listener

AsyncListener<E & Record<keyof E, unknown[]>, K>

The function to call when the event is emitted.

onRejected?

(reason: any) => unknown | null

Returns

Listener<E & Record<keyof E, unknown[]>, K>

The wrapped listener.

Inherited from

EventEmitter.onAsync


off()

off<K>(event: K, listener: Listener<E & Record<keyof E, unknown[]>, K>): void

Removes an event listener.

Type Parameters

K

K extends string | number | symbol

Parameters

event

K

The event to remove the listener from.

listener

Listener<E & Record<keyof E, unknown[]>, K>

The listener to remove.

Returns

void

Inherited from

EventEmitter.off


emit()

emit<K>(event: K, ...args: E & Record<keyof E, unknown[]>[K]): void

Emits an event to all its listeners.

Type Parameters

K

K extends string | number | symbol

Parameters

event

K

The event to emit.

args

...E & Record<keyof E, unknown[]>[K]

The arguments to pass to the listeners.

Returns

void

Inherited from

EventEmitter.emit

Accessors

id

Get Signature

get id(): string

Returns

string


path

Get Signature

get path(): string

Returns the path of this item.

Returns

string


displayPath

Get Signature

get displayPath(): string

Returns path without using this item's alias.

Returns

string


absolutePath

Get Signature

get absolutePath(): string

Returns path without using any aliases.

Returns

string


canBeEdited

Get Signature

get canBeEdited(): boolean

Returns whether this can be edited in its current state.

Returns

boolean

Built by Prozilla