Monster.Types. BaseWithOptions

This is the base class with options from which some monster classes are derived.

This class is actually only used as a base class.

Classes that require the possibility of options can be derived directly from this class. Derived classes almost always override the defaul getter with their own values.

Constructor

new BaseWithOptions(options)

Parameters:
NameTypeDescription
optionsobject
Since
  • 1.13.0
License
  • AGPLv3
Example
import {BaseWithOptions} from '@schukai/monster/source/types/basewithoptions.mjs';

class My extends BaseWithOptions {
    get defaults() {
        return Object.assign({}, super.defaults, {
            mykey: true
        });
    }
}

Members

defaults

This getter provides the options.

This getter provides the options. Derived classes overwrite this getter with their own values. It is good karma to always include the values from the parent class.

get defaults() {
    return Object.assign({}, super.defaults, {
        mykey: true
    });
}

Methods

getOption(path, defaultValue) → {*}

nested options can be specified by path a.b.c

.

nested options can be specified by path a.b.c

Parameters:
NameTypeDescription
pathstring
defaultValue*
Since
  • 1.10.0
Returns:
Type: 
*