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
app :Object
Reference to the app instance.
- Object
- Source
config :Object
Config object.
- Object
- Source
- See
- config
dispose
Dispose internal references.
- Source
dump
Alias to this.app.dump().
- Source
log :Log
Shortcut to App#log with prefix parameter set to this plugin namespace.
- Source
t
Translate text and interpolate with given args.
Shortcut to App#t with ns parameter set to this plugin namespace.
- Source
te
Check whether translation text/key exists.
Shortcut to App#te with ns parameter set to this plugin namespace.
- Source
(static, readonly) this.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) this.ns :string
Namespace (ns) or plugin's name. Simply the camel cased version of plugin's package name.
- string
- Source
(static, constant) this.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 | string | 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 | string | 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
getPkgInfo(diropt, keysopt)
Get package info.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
dir | string | <optional> | Package directory. Defaults to the current plugin's package dir. | |
keys | Array | <optional> | ['name', 'version', 'description', 'author', 'license', 'homepage', 'bajo'] | Field keys to be use. Set empty to use all keys. |
- Source
selfBind(names)
Force bind methods to self (this).
| Name | Type | Description |
|---|---|---|
names | Array.<string> | Method's names. |
- Source