Class VirtualRoot
Source: virtualRoot.ts
A virtual folder that serves as the root folder
Extends
Accessors
absolutePath
Get Signature
get absolutePath():
string
Returns path without using any aliases
Returns
string
Inherited from
canBeEdited
Get Signature
get canBeEdited():
boolean
Returns whether this can be edited in its current state
Returns
boolean
Inherited from
displayPath
Get Signature
get displayPath():
string
Returns path without using this item's alias
Returns
string
Overrides
id
Get Signature
get id():
string
Returns
string
Inherited from
path
Get Signature
get path():
string
Returns the path of this item
Returns
string
Overrides
Constructors
Constructor
new VirtualRoot(
systemManager:SystemManager):VirtualRoot
Parameters
systemManager
Returns
VirtualRoot
Overrides
Methods
addShortcut()
addShortcut(
name:string,destination:VirtualFolder|VirtualFile|VirtualFileLink|VirtualFolderLink):VirtualRoot
Adds a shortcut to a file or folder
Parameters
name
string
destination
VirtualFolder | VirtualFile | VirtualFileLink | VirtualFolderLink
Returns
VirtualRoot
confirmChanges()
confirmChanges(
root?:VirtualRoot):void
Parameters
root?
VirtualRoot
Returns
void
Inherited from
createFile()
createFile(
name:string,extension?:string,callback?: (newFile:VirtualFile|VirtualFileLink) =>void):this
Creates a file with a name and extension
Parameters
name
string
extension?
string
callback?
(newFile: VirtualFile | VirtualFileLink) => void
Returns
this
Inherited from
createFileLink()
createFileLink(
name:string,callback?: (newFileLink:VirtualFile|VirtualFileLink) =>void):this
Creates a file link with a name
Parameters
name
string
callback?
(newFileLink: VirtualFile | VirtualFileLink) => void
Returns
this
Inherited from
createFileLinks()
createFileLinks(
fileLinks: {name:string; }[]):this
Creates file links based on an array of objects with file names and extensions
Parameters
fileLinks
{ name: string; }[]
Returns
this
Inherited from
createFiles()
createFiles(
files: {extension:string;name:string; }[]):this
Creates files based on an array of objects with file names and extensions
Parameters
files
{ extension: string; name: string; }[]
Returns
this
Inherited from
createFolder()
createFolder(
name:string,callback?: (newFolder:VirtualFolder) =>void):this
Creates a folder with a name
Parameters
name
string
callback?
(newFolder: VirtualFolder) => void
Returns
this
Inherited from
createFolderLink()
createFolderLink(
name:string,callback?: (newFolderLink:VirtualFolder|VirtualFolderLink) =>void):this
Creates a folder link with a name
Parameters
name
string
callback?
(newFolderLink: VirtualFolder | VirtualFolderLink) => void
Returns
this
Inherited from
VirtualFolder.createFolderLink
createFolderLinks()
createFolderLinks(
names:string[]):this
Creates folder links based on an array of folder names
Parameters
names
string[]
Returns
this
Inherited from
VirtualFolder.createFolderLinks
createFolders()
createFolders(
names:string[]):this
Creates folders based on an array of folder names
Parameters
names
string[]
Returns
this
Inherited from
delete()
delete():
void
Deletes this folder and all its files and sub-folders recursively
Returns
void
Inherited from
emit()
emit<
Key>(eventName:Key,data?:unknown):void
Dispatch event
Type Parameters
Key
Key extends string
Parameters
eventName
Key
data?
unknown
Returns
void
Inherited from
findFile()
findFile(
name:string,extension?:string|null):VirtualFile|VirtualFileLink|null
Finds and returns a file inside this folder matching a name and extension
Parameters
name
string
extension?
string | null
Returns
VirtualFile | VirtualFileLink | null
Inherited from
findSubFolder()
findSubFolder(
name:string):VirtualFolder|VirtualFolderLink|null
Finds and returns a folder inside this folder matching a name
Parameters
name
string
Returns
VirtualFolder | VirtualFolderLink | null
Inherited from
getFiles()
getFiles(
showHidden:boolean):VirtualFile[]
Returns all files inside this folder
Parameters
showHidden
boolean = false
Whether to include hidden files
Returns
Inherited from
getIconUrl()
getIconUrl():
string
Returns
string
Inherited from
getItemCount()
getItemCount(
includeHidden:boolean):number
Returns the amount of files and sub-folders inside this folder
Parameters
includeHidden
boolean = false
Whether to include hidden files and folders in the count
Returns
number
Inherited from
getRoot()
getRoot():
VirtualRoot
Returns the root folder
Returns
VirtualRoot
Inherited from
getSubFolders()
getSubFolders(
showHidden:boolean):VirtualFolder[]
Returns all sub-folders inside this folder
Parameters
showHidden
boolean = false
Whether to include hidden folders
Returns
Inherited from
getType()
getType():
string
Returns
string
Inherited from
hasFile()
hasFile(
name:string,extension?:string):boolean
Returns true if this folder contains a file matching a name and extension
Parameters
name
string
extension?
string
Returns
boolean
Inherited from
hasFolder()
hasFolder(
name:string):boolean
Returns true if this folder contains a folder matching a name
Parameters
name
string
Returns
boolean
Inherited from
init()
init():
VirtualRoot
Initializes this root by loading the default data and then the user's data on top
Returns
VirtualRoot
isFile()
isFile():
boolean
Returns
boolean
Inherited from
isFolder()
isFolder():
boolean
Returns
boolean
Inherited from
isValidFileName()
staticisValidFileName(_name:string):boolean
Parameters
_name
string
Returns
boolean
isValidFolderName()
staticisValidFolderName(_name:string):boolean
Parameters
_name
string
Returns
boolean
isValidName()
staticisValidName(_name:string):boolean
Parameters
_name
string
Returns
boolean
loadData()
loadData():
void
Returns
void
loadDefaultData()
loadDefaultData():
void
Returns
void
navigate()
navigate(
relativePath:string):VirtualFolder|VirtualFile|null
Returns the file or folder at a relative path or null if it doesn't exist
Parameters
relativePath
string
Returns
VirtualFolder | VirtualFile | null
Inherited from
off()
off<
Key>(eventName:Key,callback:Listener):void
Remove event listener for an event
Type Parameters
Key
Key extends string
Parameters
eventName
Key
callback
Returns
void
Inherited from
on()
Add event listener for an event
Type Parameters
Key
Key extends string
Parameters
eventName
Key
callback
Returns
Inherited from
open()
open(
windowsManager:WindowsManager):object|null|undefined
Opens this folder in file explorer
Parameters
windowsManager
Returns
object | null | undefined
Inherited from
remove()
remove(
child:VirtualFolder|VirtualFile|VirtualFileLink|VirtualFolderLink):this
Removes a file or folder from this folder
Parameters
child
VirtualFolder | VirtualFile | VirtualFileLink | VirtualFolderLink
Returns
this
Inherited from
reset()
reset():
void
Tells the storage manager to clear all data and reloads the window
Returns
void
saveData()
saveData():
void
Calls the storage manager's store function with this root's data as a string
Returns
void
setAlias()
setAlias(
alias:string):this
Parameters
alias
string
Returns
this
Inherited from
setIconUrl()
setIconUrl(
iconUrl:string|null):this
Parameters
iconUrl
string | null
Returns
this
Inherited from
setName()
setName(
name:string):this
Parameters
name
string
Returns
this
Inherited from
setParent()
setParent(
parent:VirtualFolder):this
Parameters
parent
Returns
this
Inherited from
setProtected()
setProtected(
value:boolean):this
Parameters
value
boolean
Returns
this
Inherited from
toJSON()
toJSON():
VirtualRootJson|null
Returns
VirtualRootJson | null
Overrides
toString()
toString():
string|null
Returns a string representation of an object.
Returns
string | null
Overrides
Properties
alias
alias:
string|null|undefined
The alias of this item
Inherited from
editedByUser
editedByUser:
boolean|null|undefined
Whether this item has been edited by the user
Inherited from
EVENT_NAMES
staticEVENT_NAMES: {error:string;update:string; }
error
error:
string="error"
update
update:
string="update"
Overrides
files
files: (
VirtualFile|VirtualFileLink)[]
The files inside this folder
Inherited from
iconUrl
iconUrl:
string|null|undefined
The URL of the icon of this item
Inherited from
initiated
initiated:
boolean=false
isDeleted
isDeleted:
boolean
Whether this item has been deleted
Inherited from
isProtected
isProtected:
boolean|null|undefined
Whether this item is protected from changes
Inherited from
isRoot
isRoot:
boolean|null|undefined
Whether this item is the root folder
Inherited from
linkedFile
linkedFile:
VirtualFile|null|undefined
The file this item links to
Inherited from
linkedFolder
linkedFolder:
VirtualFolder|null|undefined
The folder this item links to
Inherited from
loadedDefaultData
loadedDefaultData:
boolean=false
name
name:
string
The name of this item
Inherited from
parent
parent:
VirtualFolder|null|undefined
The folder this item is in
Inherited from
root
root:
VirtualRoot|null|undefined
The root folder
Inherited from
shortcuts
shortcuts:
Record<string,VirtualFile|VirtualFileLink|VirtualFolder|VirtualFolderLink>
Aliases for files and folders
subFolders
subFolders: (
VirtualFolder|VirtualFolderLink)[]
The folders inside this folder
Inherited from
systemManager
systemManager:
SystemManager
type
type:
number|undefined
The type of this folder
Default
VirtualFolder.TYPE.generalInherited from
TYPE
staticTYPE: {general:number;media:number; }
general
general:
number=0
media
media:
number=1