Core
Extends:
Main Core class for OS.js service providers and bootstrapping.
Constructor Summary
| Public Constructor | ||
| public |
constructor(config: CoreConfig, options: CoreOptions) Create core instance |
|
Member Summary
| Public Members | ||
| public |
$contents: Element Windows etc DOM element |
|
| public |
$resourceRoot: Element Resource script container DOM element |
|
| public |
$root: Element Main DOM element |
|
| public |
Ping (stay alive) interval |
|
| public |
Default fetch request options |
|
| public |
Splash instance |
|
| public |
Url Resolver TODO: typedef |
|
| public |
Current user data |
|
| public |
Websocket connection |
|
Method Summary
| Public Methods | ||
| public |
Boots up OS.js |
|
| public |
Sends a 'broadcast' event with given arguments to all applications matching given filter |
|
| public |
Destroy core instance |
|
| public |
Gets the current user |
|
| public |
Kills the specified application |
|
| public |
middleware(group: string, callback: Function): * Add middleware function to a group |
|
| public |
Removes an event handler |
|
| public |
open(file: VFSFile, options: CoreOpenOptions): Boolean | Application Spawns an application based on the file given |
|
| public |
Make a HTTP request |
|
| public |
run(name: string, args: {foo: *}, options: PackageLaunchOptions): Promise<Application> Create an application from a package |
|
| public |
Sends a signal to the server over websocket. |
|
| public |
setRequestOptions(options: object) Set the internal fetch/request options |
|
| public |
Starts all core services |
|
| public |
url(endpoint: string, options: object, metadata: PackageMetadata): string Creates an URL based on configured public path |
|
| Private Methods | ||
| private |
Attaches some internal events |
|
| private |
_createConnection(cb: Function): boolean Creates the main connection to server |
|
| private |
Creates event listeners* |
|
| private |
_openApplicationDialog(options: *, compatible: *, file: *, run: *) Wrapper method to create an application choice dialog |
|
Public Constructors
public constructor(config: CoreConfig, options: CoreOptions) source
Create core instance
Params:
| Name | Type | Attribute | Description |
| config | CoreConfig |
|
Configuration tree |
| options | CoreOptions |
|
Options |
Public Members
Public Methods
public broadcast(pkg: string | Function, name: string): string[] source
Sends a 'broadcast' event with given arguments to all applications matching given filter
public middleware(group: string, callback: Function): * source
Add middleware function to a group
Return:
| * |
public open(file: VFSFile, options: CoreOpenOptions): Boolean | Application source
Spawns an application based on the file given
Params:
| Name | Type | Attribute | Description |
| file | VFSFile | A file object |
|
| options | CoreOpenOptions |
|
Options |
public request(url: string, options: Options, type: string, force: boolean): * source
Make a HTTP request
This is a wrapper for making a 'fetch' request with some helpers and integration with OS.js
Return:
| * |
public run(name: string, args: {foo: *}, options: PackageLaunchOptions): Promise<Application> source
Create an application from a package
Params:
| Name | Type | Attribute | Description |
| name | string | Package name |
|
| args | {foo: *} |
|
Launch arguments |
| options | PackageLaunchOptions |
|
Launch options |
See:
public send(name: string): * source
Sends a signal to the server over websocket. This will be interpreted as an event in the server core.
Params:
| Name | Type | Attribute | Description |
| name | string | Event name |
|
| ...params | * | Event callback parameters |
Return:
| * |
public setRequestOptions(options: object) source
Set the internal fetch/request options
Params:
| Name | Type | Attribute | Description |
| options | object | Request options |
public url(endpoint: string, options: object, metadata: PackageMetadata): string source
Creates an URL based on configured public path
If you give a options.type, the URL will be resolved to the correct resource.
Params:
| Name | Type | Attribute | Description |
| endpoint | string |
|
Endpoint |
| options | object |
|
Additional options for resolving url |
| options.prefix | boolean |
|
Returns a full URL complete with scheme, etc. (will always be true on websocket) |
| options.type | string |
|
Optional URL type (websocket) |
| metadata | PackageMetadata |
|
A package metadata |
Private Methods
private _createConnection(cb: Function): boolean source
Creates the main connection to server
Params:
| Name | Type | Attribute | Description |
| cb | Function | Callback function |
private _openApplicationDialog(options: *, compatible: *, file: *, run: *) source
Wrapper method to create an application choice dialog
Params:
| Name | Type | Attribute | Description |
| options | * | ||
| compatible | * | ||
| file | * | ||
| run | * |
