Constructor
new Plugin(pkgName, app)
Name | Type | Description |
---|---|---|
pkgName | string | Package name (the one you use in package.json) |
app | Object | App instance reference. Usefull to call app method inside a plugin |
- Source
Members
alias :string
Getter for plugin's alias
- string
- Source
app :Object
Reference to app instance
- Object
- Source
config :Object
Config object
- Object
- Source
- See
- config
log :Log
Shortcut to App#log with prefix parameter set to this plugin name.
- Source
ns :string
Getter for plugin's ns
- string
- Source
pkgName :string
Getter for plugin's package name
- string
- Source
t
Translate text and interpolate with given args
.
Shortcut to App#t with ns parameter set to this plugin namespace.
- Source
(static, readonly) alias :string
Plugin alias. Derived plugin must provide its own, unique alias. If it left blank, Bajo will provide this automatically (by using the kebab-cased version of plugin name)
- string
- Source
(static, constant) ns :string
Namespace (ns) or plugin's name. Simply the camel cased version of plugin's package name
- string
- Source
(static, constant) pkgName :string
Package name, the one from package.json
- string
- Source
Methods
error(msg, …argsopt) → {Object}
Create an instance of Err object
Name | Type | Attributes | Description |
---|---|---|---|
msg | msg | Error message | |
args | any | <optional> <repeatable> | Argument variables you might want to add to the error object |
- Source
Err instance
- Type:
- Object
fatal(msg, …argsopt)
Create an instance of Err object, display it on screen and then force terminate the app process
Name | Type | Attributes | Description |
---|---|---|---|
msg | msg | Error message | |
args | any | <optional> <repeatable> | Argument variables you might want to add to the error object |
- Source
getConfig(pathopt, optionsopt) → {Object}
Get plugin's config value
Name | Type | Attributes | Default | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
path | string | <optional> | dot separated config path (think of lodash's 'get'). If not provided, the full config will be given | |||||||||||||||||||||
options | Object | <optional> | {} | Options Properties
|
- Source
Returned object. If no path provided, the whole config object is returned
- Type:
- Object