Function
Static Public Summary | ||
public |
Application VFS adapter |
|
public |
System VFS adapter |
|
public |
applyBackgroundStyles(core: *, background: *) Creates a set of styles based on background settings |
|
public |
Get basename of a file |
|
public |
browserLocale(nav: object): string Returns the navigator language |
|
public |
capabilities(path: string | VFSFile, options: VFSMethodOptions): Promise<object[]> Get vfs capabilities |
|
public |
Copies a file or directory (move) |
|
public |
create(core: *, $element: *): * Search UI Adapter |
|
public |
create(options: *, login: *, startHidden: *, $container: *): * Login UI Adapter |
|
public |
createCssText(obj: object): string Serialize an object to CSS |
|
public |
createDOMAttributes(id: string, state: WindowState, attributes: WindowAttributes): object Creates data attributes for window DOM |
|
public |
createDOMStyles(state: WindowState, attributes: WindowAttributes): object Creates styles for window DOM |
|
public |
createFileIter(stat: object): object Creates a file iter for scandir |
|
public |
createNativeNotification(options: object, onclick: Function): Promise<window.Notification> Creates a native notification |
|
public |
createPanelSubtraction(panel: *, panels: *): * Creates a rectangle with the realestate panels takes up |
|
public |
createWatchEvents(method: *, args: *): object[] Creates a list of VFS events to simulate server-side file watching |
|
public |
Creates a double-tap event handler |
|
public |
download(path: string | VFSFile, options: VFSDownloadOptions): Promise<any> Initiates a native browser download of the file |
|
public |
draggable(el: Element, options: DraggableOptions): DraggableInstance Creates a "draggable" element |
|
public |
droppable(el: Element, options: DroppableOptions): DroppableInstance Creates a "droppable" element |
|
public |
escapeHtml(text: string): string Escape text so it is "safe" for HTML usage |
|
public |
Checks if path exists |
|
public |
Make a HTTP request |
|
public |
filterMountByGroups(userGroups: *): boolean Filters a mountpoint by user groups |
|
public |
Formats a given Date to a specified format |
|
public |
getEvent(ev: Event): NormalizedEventPosition Normalizes event input (position) |
|
public |
getFileIcon(file: object): string | object Gets an icon from file stat |
|
public |
Gest the set localization |
|
public |
handleTabOnTextarea(ev: Event) Inserts a tab in the given event target |
|
public |
humanFileSize(bytes: Number, si: Boolean): string Converts a number (bytez) into human-readable string |
|
public |
Inverts a HEX color |
|
public |
isDroppingImage(data: *): boolean Check if droppable data contains image |
|
public |
loadOptionsFromConfig(config: *, appName: *, windowId: *): * Loads [certain] window options from configuration |
|
public |
localStorageAuth(core: Core, options: object) LocalStorage Auth adapter |
|
public |
localStorageSettings(core: Core, options: object): * LocalStorage Settings adapter |
|
public |
matchKeyCombo(combo: string, ev: Event): boolean Checks if keycombo matches |
|
public |
Creates a directory |
|
public |
parentDirectory(path: string): string Get parent directory |
|
public |
parseMountpointPrefix(str: string): string Gets prefix from vfs path |
|
public |
Joins paths |
|
public |
Plays a sound |
|
public |
Read a directory |
|
public |
readfile(path: string | VFSFile, type: string, options: VFSMethodOptions): Promise<ArrayBuffer> Reads a file |
|
public |
Renames a file or directory (move) |
|
public |
Creates a new Script DOM element |
|
public |
Searches for files and folders |
|
public |
serverAuth(core: Core, options: object): {"register": *, "login": *, "logout": *} Server Auth adapter |
|
public |
serverSettings(core: Core, options: object) Server Settings adapter |
|
public |
Gets the stats of the file or directory |
|
public |
Creates a new CSS DOM element |
|
public |
Gets supported media types |
|
public |
Touches a file |
|
public |
transformArrayBuffer(ab: ArrayBuffer, mime: string, type: string): DOMString | string | Blob | ArrayBuffer Transform an ArrayBuffer |
|
public |
transformReaddir(root: object, options: object): Object[] Transforms a readdir result |
|
public |
translatable(k: string, Format: ...args): Function Translates a given tree of locales. |
|
public |
translatableFlat(list: object, defaultValue: string): string Translates a given flat tree of locales |
|
public |
Removes a file or directory |
|
public |
Gets an URL to a resource defined by file |
|
public |
urlResolver(configuration: CoreConfig): * Resolves an URL |
|
public |
validVfsDrop(data: *): boolean Check if droppable data is a VFS type |
|
public |
writefile(path: string | VFSFile, data: ArrayBuffer | Blob | string, options: VFSMethodOptions): Promise<number> Writes a file |
Static Private Summary | ||
private |
Translates a key + arguments from a tree of translations |
Static Public
public adapter(core: Core, options: object): {"readdir": *} source
import adapter from '@osjs/client/src/adapters/vfs/apps.js'
Application VFS adapter
Return:
{"readdir": *} |
public adapter(core: Core, options: object): * source
import adapter from '@osjs/client/src/adapters/vfs/system.js'
System VFS adapter
Return:
* |
public applyBackgroundStyles(core: *, background: *) source
import {applyBackgroundStyles} from '@osjs/client/src/utils/desktop.js'
Creates a set of styles based on background settings
Params:
Name | Type | Attribute | Description |
core | * | ||
background | * |
public basename(path: string): string source
import {basename} from '@osjs/client/src/utils/vfs.js'
Get basename of a file
Params:
Name | Type | Attribute | Description |
path | string | The path |
public browserLocale(nav: object): string source
import {browserLocale} from '@osjs/client/src/utils/locale.js'
Returns the navigator language
Params:
Name | Type | Attribute | Description |
nav | object |
|
public capabilities(path: string | VFSFile, options: VFSMethodOptions): Promise<object[]> source
import {capabilities} from '@osjs/client/src/vfs.js'
Get vfs capabilities
Params:
Name | Type | Attribute | Description |
path | string | VFSFile | The path of a file |
|
options | VFSMethodOptions |
|
Options |
public copy(from: string | VFSFile, to: string | VFSFile, options: VFSMethodOptions): Promise<boolean> source
import {copy} from '@osjs/client/src/vfs.js'
Copies a file or directory (move)
Params:
Name | Type | Attribute | Description |
from | string | VFSFile | The source (from) |
|
to | string | VFSFile | The destination (to) |
|
options | VFSMethodOptions |
|
Options |
public create(core: *, $element: *): * source
import create from '@osjs/client/src/adapters/ui/search.js'
Search UI Adapter
Params:
Name | Type | Attribute | Description |
core | * | ||
$element | * |
Return:
* |
public create(options: *, login: *, startHidden: *, $container: *): * source
import create from '@osjs/client/src/adapters/ui/login.js'
Login UI Adapter
Params:
Name | Type | Attribute | Description |
options | * | ||
login | * | ||
startHidden | * | ||
$container | * |
Return:
* |
public createCssText(obj: object): string source
import {createCssText} from '@osjs/client/src/utils/dom.js'
Serialize an object to CSS
Params:
Name | Type | Attribute | Description |
obj | object | Object |
public createDOMAttributes(id: string, state: WindowState, attributes: WindowAttributes): object source
import {createDOMAttributes} from '@osjs/client/src/utils/windows.js'
Creates data attributes for window DOM
Params:
Name | Type | Attribute | Description |
id | string | ||
state | WindowState | ||
attributes | WindowAttributes |
public createDOMStyles(state: WindowState, attributes: WindowAttributes): object source
import {createDOMStyles} from '@osjs/client/src/utils/windows.js'
Creates styles for window DOM
Params:
Name | Type | Attribute | Description |
state | WindowState | ||
attributes | WindowAttributes |
public createFileIter(stat: object): object source
import {createFileIter} from '@osjs/client/src/utils/vfs.js'
Creates a file iter for scandir
Params:
Name | Type | Attribute | Description |
stat | object | file stat |
public createNativeNotification(options: object, onclick: Function): Promise<window.Notification> source
import {createNativeNotification} from '@osjs/client/src/utils/dom.js'
Creates a native notification
public createPanelSubtraction(panel: *, panels: *): * source
import {createPanelSubtraction} from '@osjs/client/src/utils/desktop.js'
Creates a rectangle with the realestate panels takes up
Params:
Name | Type | Attribute | Description |
panel | * | ||
panels | * |
Return:
* |
public createWatchEvents(method: *, args: *): object[] source
import {createWatchEvents} from '@osjs/client/src/utils/vfs.js'
Creates a list of VFS events to simulate server-side file watching
Params:
Name | Type | Attribute | Description |
method | * | ||
args | * |
public doubleTap(timeout: number): Function source
import {doubleTap} from '@osjs/client/src/utils/input.js'
Creates a double-tap event handler
Params:
Name | Type | Attribute | Description |
timeout | number |
|
Timeout |
public download(path: string | VFSFile, options: VFSDownloadOptions): Promise<any> source
import {download} from '@osjs/client/src/vfs.js'
Initiates a native browser download of the file
Params:
Name | Type | Attribute | Description |
path | string | VFSFile | The file |
|
options | VFSDownloadOptions |
|
Options |
public draggable(el: Element, options: DraggableOptions): DraggableInstance source
import {draggable} from '@osjs/client/src/utils/dnd.js'
Creates a "draggable" element
Params:
Name | Type | Attribute | Description |
el | Element | The DOM element to apply to |
|
options | DraggableOptions |
|
Options |
public droppable(el: Element, options: DroppableOptions): DroppableInstance source
import {droppable} from '@osjs/client/src/utils/dnd.js'
Creates a "droppable" element
Params:
Name | Type | Attribute | Description |
el | Element | The DOM element to apply to |
|
options | DroppableOptions |
|
Options |
public escapeHtml(text: string): string source
import {escapeHtml} from '@osjs/client/src/utils/dom.js'
Escape text so it is "safe" for HTML usage
Params:
Name | Type | Attribute | Description |
text | string | Input text |
public exists(path: string | VFSFile, options: VFSMethodOptions): Promise<boolean> source
import {exists} from '@osjs/client/src/vfs.js'
Checks if path exists
Params:
Name | Type | Attribute | Description |
path | string | VFSFile | The path to check |
|
options | VFSMethodOptions |
|
Options |
public fetch(url: string, options: Options, type: string): Promise<*> source
import {fetch} from '@osjs/client/src/utils/fetch.js'
Make a HTTP request
public filterMountByGroups(userGroups: *): boolean source
import {filterMountByGroups} from '@osjs/client/src/utils/vfs.js'
Filters a mountpoint by user groups
Params:
Name | Type | Attribute | Description |
userGroups | * |
public format(date: Date, fmt: string): string source
import {format} from '@osjs/client/src/utils/locale.js'
Formats a given Date to a specified format
Will automatically detect the current locale from the user.
Formats are 'shortDate', 'mediumDate', 'longDate', 'fullDate', 'shortTime' and 'longTime'
public getEvent(ev: Event): NormalizedEventPosition source
import {getEvent} from '@osjs/client/src/utils/input.js'
Normalizes event input (position)
Params:
Name | Type | Attribute | Description |
ev | Event | Event |
public getFileIcon(file: object): string | object source
import {getFileIcon} from '@osjs/client/src/utils/vfs.js'
Gets an icon from file stat
Params:
Name | Type | Attribute | Description |
file | object | The file stat object |
public getLocale(core: Core, key: string): object source
import {getLocale} from '@osjs/client/src/utils/locale.js'
Gest the set localization
public handleTabOnTextarea(ev: Event) source
import {handleTabOnTextarea} from '@osjs/client/src/utils/dom.js'
Inserts a tab in the given event target
Params:
Name | Type | Attribute | Description |
ev | Event | DOM Event |
public humanFileSize(bytes: Number, si: Boolean): string source
import {humanFileSize} from '@osjs/client/src/utils/vfs.js'
Converts a number (bytez) into human-readable string
public invertHex(hex: string): string source
import {invertHex} from '@osjs/client/src/utils/colors.js'
Inverts a HEX color
Params:
Name | Type | Attribute | Description |
hex | string | Color hex code |
public isDroppingImage(data: *): boolean source
import {isDroppingImage} from '@osjs/client/src/utils/desktop.js'
Check if droppable data contains image
Params:
Name | Type | Attribute | Description |
data | * |
public loadOptionsFromConfig(config: *, appName: *, windowId: *): * source
import {loadOptionsFromConfig} from '@osjs/client/src/utils/windows.js'
Loads [certain] window options from configuration
Params:
Name | Type | Attribute | Description |
config | * | ||
appName | * | ||
windowId | * |
Return:
* |
public localStorageAuth(core: Core, options: object) source
import localStorageAuth from '@osjs/client/src/adapters/auth/localstorage.js'
LocalStorage Auth adapter
public localStorageSettings(core: Core, options: object): * source
import localStorageSettings from '@osjs/client/src/adapters/settings/localstorage.js'
LocalStorage Settings adapter
Return:
* |
public matchKeyCombo(combo: string, ev: Event): boolean source
import {matchKeyCombo} from '@osjs/client/src/utils/input.js'
Checks if keycombo matches
Params:
Name | Type | Attribute | Description |
combo | string | Key combo |
|
ev | Event | Event |
public mkdir(path: string | VFSFile, options: VFSMethodOptions): Promise<boolean> source
import {mkdir} from '@osjs/client/src/vfs.js'
Creates a directory
Params:
Name | Type | Attribute | Description |
path | string | VFSFile | The path to new directory |
|
options | VFSMethodOptions |
|
Options |
public parentDirectory(path: string): string source
import {parentDirectory} from '@osjs/client/src/utils/vfs.js'
Get parent directory
Params:
Name | Type | Attribute | Description |
path | string | Directory |
public parseMountpointPrefix(str: string): string source
import {parseMountpointPrefix} from '@osjs/client/src/utils/vfs.js'
Gets prefix from vfs path
Params:
Name | Type | Attribute | Description |
str | string | Input |
public pathJoin(args: string[]): string source
import {pathJoin} from '@osjs/client/src/utils/vfs.js'
Joins paths
Params:
Name | Type | Attribute | Description |
args | string[] | paths |
public playSound(src: string, options: object): Promise<HTMLAudioElement> source
import {playSound} from '@osjs/client/src/utils/dom.js'
Plays a sound
public readdir(path: string | VFSFile, options: VFSMethodOptions): Promise<object[]> source
import {readdir} from '@osjs/client/src/vfs.js'
Read a directory
Params:
Name | Type | Attribute | Description |
path | string | VFSFile | The path to read |
|
options | VFSMethodOptions |
|
Options |
public readfile(path: string | VFSFile, type: string, options: VFSMethodOptions): Promise<ArrayBuffer> source
import {readfile} from '@osjs/client/src/vfs.js'
Reads a file
Available types are 'arraybuffer', 'blob', 'uri' and 'string'
Params:
Name | Type | Attribute | Description |
path | string | VFSFile | The path to read |
|
type | string |
|
Return this content type |
options | VFSMethodOptions |
|
Options |
public rename(from: string | VFSFile, to: string | VFSFile, options: VFSMethodOptions): Promise<boolean> source
import {rename} from '@osjs/client/src/vfs.js'
Renames a file or directory (move)
Params:
Name | Type | Attribute | Description |
from | string | VFSFile | The source (from) |
|
to | string | VFSFile | The destination (to) |
|
options | VFSMethodOptions |
|
Options |
public script(root: Element, src: string, options: Object): Promise<StyleElement> source
import {script} from '@osjs/client/src/utils/dom.js'
Creates a new Script DOM element
public search(root: string | VFSFile, pattern: string, options: VFSMethodOptions): Promise<object[]> source
import {search} from '@osjs/client/src/vfs.js'
Searches for files and folders
Params:
Name | Type | Attribute | Description |
root | string | VFSFile | The root |
|
pattern | string | Search pattern |
|
options | VFSMethodOptions |
|
Options |
public serverAuth(core: Core, options: object): {"register": *, "login": *, "logout": *} source
import serverAuth from '@osjs/client/src/adapters/auth/server.js'
Server Auth adapter
Return:
{"register": *, "login": *, "logout": *} |
public serverSettings(core: Core, options: object) source
import serverSettings from '@osjs/client/src/adapters/settings/server.js'
Server Settings adapter
public stat(path: string | VFSFile, options: VFSMethodOptions): Promise<object> source
import {stat} from '@osjs/client/src/vfs.js'
Gets the stats of the file or directory
Params:
Name | Type | Attribute | Description |
path | string | VFSFile | The path to check |
|
options | VFSMethodOptions |
|
Options |
public style(root: Element, src: string): Promise<ScriptElement> source
import {style} from '@osjs/client/src/utils/dom.js'
Creates a new CSS DOM element
Params:
Name | Type | Attribute | Description |
root | Element | Root node |
|
src | string | Source |
public supportedMedia(): object source
import {supportedMedia} from '@osjs/client/src/utils/dom.js'
Gets supported media types
public touch(path: string | VFSFile): Promise<boolean> source
import {touch} from '@osjs/client/src/vfs.js'
Touches a file
public transformArrayBuffer(ab: ArrayBuffer, mime: string, type: string): DOMString | string | Blob | ArrayBuffer source
import {transformArrayBuffer} from '@osjs/client/src/utils/vfs.js'
Transform an ArrayBuffer
Params:
Name | Type | Attribute | Description |
ab | ArrayBuffer | The ArrayBuffer |
|
mime | string | The MIME type |
|
type | string | Transform to this type |
public transformReaddir(root: object, options: object): Object[] source
import {transformReaddir} from '@osjs/client/src/utils/vfs.js'
Transforms a readdir result
Params:
Name | Type | Attribute | Description |
root | object | The path to the readdir root |
|
Object[] | * | files An array of readdir results |
|
options | object | Options |
|
options.showHiddenFiles | Boolean |
|
Show hidden files |
options.filter | Function |
|
A filter |
options.sortBy | string |
|
Sort by this attribute |
options.sortDir | string |
|
Sort in this direction |
public translatable(k: string, Format: ...args): Function source
import {translatable} from '@osjs/client/src/utils/locale.js'
Translates a given tree of locales.
Will automatically detect the current locale from the user.
Returns a translate
function that takes a key and list of arguments.
Example:
translatable({en_EN: {foo: 'Hello {0}'}})
('foo', 'World'); // => 'Hello World'
See:
public translatableFlat(list: object, defaultValue: string): string source
import {translatableFlat} from '@osjs/client/src/utils/locale.js'
Translates a given flat tree of locales
Will automatically detect the current locale from the user.
Returns a function that takes a key and returns the correct string.
Example:
translatableFlat({en_EN: 'Hello World'}); // => 'Hello World'
public unlink(path: string | VFSFile, options: VFSMethodOptions): Promise<boolean> source
import {unlink} from '@osjs/client/src/vfs.js'
Removes a file or directory
Params:
Name | Type | Attribute | Description |
path | string | VFSFile | The path to remove |
|
options | VFSMethodOptions |
|
Options |
public url(path: string | VFSFile, options: VFSMethodOptions): Promise<string> source
import {url} from '@osjs/client/src/vfs.js'
Gets an URL to a resource defined by file
Params:
Name | Type | Attribute | Description |
path | string | VFSFile | The file |
|
options | VFSMethodOptions |
|
Options |
public urlResolver(configuration: CoreConfig): * source
import {urlResolver} from '@osjs/client/src/utils/url.js'
Resolves an URL
Params:
Name | Type | Attribute | Description |
configuration | CoreConfig |
Return:
* |
public validVfsDrop(data: *): boolean source
import {validVfsDrop} from '@osjs/client/src/utils/desktop.js'
Check if droppable data is a VFS type
Params:
Name | Type | Attribute | Description |
data | * |
public writefile(path: string | VFSFile, data: ArrayBuffer | Blob | string, options: VFSMethodOptions): Promise<number> source
import {writefile} from '@osjs/client/src/vfs.js'
Writes a file
Params:
Name | Type | Attribute | Description |
path | string | VFSFile | The path to write |
|
data | ArrayBuffer | Blob | string | The data |
|
options | VFSMethodOptions |
|
Options |
Static Private
private translate(list: object, ul: string, dl: string, k: string, args: ...*): string source
import {translate} from '@osjs/client/src/utils/locale.js'
Translates a key + arguments from a tree of translations
Example:
translate({en_EN: {foo: 'Hello {0}'}}, 'nb_NO', 'en_EN', 'foo', 'World') => 'Hello World'