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

Package

OS.js Package Abstraction

Constructor Summary

Public Constructor
public

constructor(core: Core, options: PackageOptions)

Create new instance

Member Summary

Public Members
public
public
public

Method Summary

Public Methods
public

action(method: string): boolean

Run method on package script

public

async destroy()

Destroys instance

public

Initializes this package

public

Resolve an URL for resource

public

Starts server scripts

public

Validates this package

public

Creates a watch in package dist

Public Constructors

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

Create new instance

Params:

NameTypeAttributeDescription
core Core

Core reference

options PackageOptions
  • optional

Instance options

Public Members

public core: Core source

public filename: string source

public metadata: PackageMetadata source

Public Methods

public action(method: string): boolean source

Run method on package script

Params:

NameTypeAttributeDescription
method string

Method name

...args *
  • optional

Pass arguments

Return:

boolean

public async destroy() source

Destroys instance

public init(): Promise<undefined> source

Initializes this package

Return:

Promise<undefined>

public resource(path: string): string source

Resolve an URL for resource

Params:

NameTypeAttributeDescription
path string

Input path

Return:

string

public start(): Promise<undefined> source

Starts server scripts

Return:

Promise<undefined>

public validate(manifest: PackageMetadata[]): boolean source

Validates this package

Params:

NameTypeAttributeDescription
manifest PackageMetadata[]

Global manifest

Return:

boolean

public watch(cb: Function): string source

Creates a watch in package dist

Params:

NameTypeAttributeDescription
cb Function

Callback function on watch changes

Return:

string

Watched path