Home Reference Source
import {BasicApplication} from '@osjs/client/src/basic-application.js'
public class | source

BasicApplication

Extends:

@osjs/event-emitter~EventEmitter → BasicApplication

Basic Application Helper

A class for helping creating basic applications with open/load/create functionality. Also sets the internal proc args for sessions.

Constructor Summary

Public Constructor
public

Basic Application Constructor

Member Summary

Public Members
public

Core instance reference

public

Basic Application Options

public

Application instance reference

public

Window instance reference

Method Summary

Public Methods
public

create()

Create new file

public

createDialog(type: string, cb: Function, options: object)

Creates a new dialog of a type

public

Create new file

public

Creates a new load dialog

public

Creates a new save dialog

public

Destroys all Basic Application internals

public

Gets options for a dialog

public

Initializes the application

public

open(file: VFSFile)

Opens given file

public

save(file: VFSFile)

Saves given file

public

Updates the window title to match open file

Private Methods
private

Creates the window title

private

_setFile(item: VFSFile, eventName: string)

Sets file from open/save action

Public Constructors

public constructor(core: Core, proc: Application, win: Window, options: BasicApplicationOptions) source

Basic Application Constructor

Params:

NameTypeAttributeDescription
core Core

OS.js Core API

proc Application

The application process

win Window

The main application window

options BasicApplicationOptions
  • optional
  • default: {}

Basic application options

Public Members

public core: Core source

Core instance reference

public options: BasicApplicationOptions source

Basic Application Options

public proc: Application source

Application instance reference

public win: Window source

Window instance reference

Public Methods

public create() source

Create new file

Does not do any actual VFS operation

public createDialog(type: string, cb: Function, options: object) source

Creates a new dialog of a type

Params:

NameTypeAttributeDescription
type string

Dialog type

cb Function

Callback

options object
  • optional

Override options

public createNew() source

Create new file

See:

public createOpenDialog(options: object) source

Creates a new load dialog

Params:

NameTypeAttributeDescription
options object
  • optional

Dialog options

public createSaveDialog(options: object) source

Creates a new save dialog

Params:

NameTypeAttributeDescription
options object
  • optional

Dialog options

public destroy() source

Destroys all Basic Application internals

public getDialogOptions(type: string): object source

Gets options for a dialog

Params:

NameTypeAttributeDescription
type string

Dialog type

Return:

object

public init(): Promise<boolean> source

Initializes the application

Return:

Promise<boolean>

public open(file: VFSFile) source

Opens given file

Does not do any actual VFS operation

Params:

NameTypeAttributeDescription
file VFSFile

A file

public save(file: VFSFile) source

Saves given file

Does not do any actual VFS operation

Params:

NameTypeAttributeDescription
file VFSFile

A file

public updateWindowTitle() source

Updates the window title to match open file

Private Methods

private _createTitle(prefix: string): string source

Creates the window title

Params:

NameTypeAttributeDescription
prefix string

Title prefix

Return:

string

private _setFile(item: VFSFile, eventName: string) source

Sets file from open/save action

Params:

NameTypeAttributeDescription
item VFSFile

File

eventName string

Event to fire