Home Reference Source
import Packages from '@osjs/server/src/packages.js'
public class | source

Packages

OS.js Package Management

Constructor Summary

Public Constructor
public

constructor(core: Core, options: PackagesOptions)

Create new instance

Member Summary

Public Members
public
public
public

Method Summary

Public Methods
public

Loads all packages

public

Destroys packages

public

handleMessage(ws: WebSocket, params: Array)

Handles an incoming message and signals an application

public

init(): *

Initializes packages

public

initializePackage(pkg: *, manifest: *, done: *): Promise<Package>

Initializes a package

public

Loads package manager

public

Loads package data

public

When a package dist has changed

public

start()

Starts packages

Public Constructors

public constructor(core: Core, options: PackagesOptions) source

Create new instance

Params:

NameTypeAttributeDescription
core Core

Core reference

options PackagesOptions
  • optional

Instance options

Public Members

public core: Core source

public options: PackagesOptions source

public packages: Package[] source

Public Methods

public createLoader(): Promise<Package[]> source

Loads all packages

Return:

Promise<Package[]>

public async destroy(): Promise<undefined> source

Destroys packages

Return:

Promise<undefined>

public handleMessage(ws: WebSocket, params: Array) source

Handles an incoming message and signals an application

This will call the 'onmessage' event in your application server script

Params:

NameTypeAttributeDescription
ws WebSocket

Websocket Connection client

params Array

A list of incoming parameters

public init(): * source

Initializes packages

Return:

*

public initializePackage(pkg: *, manifest: *, done: *): Promise<Package> source

Initializes a package

Params:

NameTypeAttributeDescription
pkg *
manifest *
done *

Return:

Promise<Package>

public load(): Promise<boolean> source

Loads package manager

Return:

Promise<boolean>

public loadPackage(filename: string, manifest: PackageMetadata): Promise<Package> source

Loads package data

Params:

NameTypeAttributeDescription
filename string

Filename

manifest PackageMetadata

Manifest

Return:

Promise<Package>

public onPackageChanged(pkg: Package) source

When a package dist has changed

Params:

NameTypeAttributeDescription
pkg Package

Package instance

public start() source

Starts packages