Home Reference Source
import Scripteasy from 'scripteasy'
public class | source

Scripteasy

The main scripteasy class. It serves as an entry point into scripteasy's primary functionality.

Static Method Summary

Static Public Methods
public static

fromFile(filename: string): Scripteasy

Reads scripts from a file and generates a new Scripteasy instance using those scripts.

Constructor Summary

Public Constructor
public

constructor(scripts: object)

Creates a new Scripteasy instance.

Member Summary

Public Members
public

Method Summary

Public Methods
public

Parses the scripts for a new Scripteasy instance.

public

run(name: string, args: Array<string>): Error

Runs a script by name.

Static Public Methods

public static fromFile(filename: string): Scripteasy source

Reads scripts from a file and generates a new Scripteasy instance using those scripts.

Params:

NameTypeAttributeDescription
filename string

The name of the file.

Return:

Scripteasy

A new Scripteasy instance.

Public Constructors

public constructor(scripts: object) source

Creates a new Scripteasy instance.

Params:

NameTypeAttributeDescription
scripts object

A map of scripts keyed by name. Each top level value is passed into the Script constructor as either the whole opts object or as the opts.try value.

Public Members

public scripts: Array<Script> source

Public Methods

public parseScripts(scripts: object): Array<Script> source

Parses the scripts for a new Scripteasy instance.

Params:

NameTypeAttributeDescription
scripts object

A map of scripts.

Return:

Array<Script>

The parsed scripts.

public run(name: string, args: Array<string>): Error source

Runs a script by name.

Params:

NameTypeAttributeDescription
name string

The name of the script to run.

args Array<string>
  • optional

The args to pass into the script.

Return:

Error

If an error occurs, the error is returned.