bajo 2.18.0 → 2.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/class/_helper.js +22 -7
- package/class/app.js +59 -45
- package/class/bajo.js +150 -129
- package/class/base.js +3 -3
- package/class/cache.js +60 -0
- package/class/err.js +14 -11
- package/class/log.js +41 -40
- package/class/plugin.js +35 -36
- package/class/print.js +54 -51
- package/class/tools.js +3 -4
- package/docs/App.html +7 -7
- package/docs/Bajo.html +2 -2
- package/docs/Base.html +1 -1
- package/docs/Cache.html +3 -0
- package/docs/Err.html +2 -2
- package/docs/Log.html +2 -2
- package/docs/Plugin.html +1 -1
- package/docs/Print.html +1 -1
- package/docs/Tools.html +3 -0
- package/docs/class__helper.js.html +694 -0
- package/docs/class_app.js.html +307 -149
- package/docs/class_bajo.js.html +316 -464
- package/docs/class_base.js.html +35 -32
- package/docs/class_cache.js.html +150 -0
- package/docs/class_err.js.html +144 -0
- package/docs/class_log.js.html +270 -0
- package/docs/class_plugin.js.html +98 -71
- package/docs/class_print.js.html +261 -0
- package/docs/class_tools.js.html +44 -0
- package/docs/data/search.json +1 -1
- package/docs/global.html +1 -4
- package/docs/index.html +1 -1
- package/docs/index.js.html +21 -14
- package/docs/lib_find-deep.js.html +27 -0
- package/docs/lib_formats.js.html +19 -19
- package/docs/lib_freeze.js.html +19 -0
- package/docs/lib_import-module.js.html +16 -14
- package/docs/lib_index.js.html +9 -0
- package/docs/lib_log-levels.js.html +2 -2
- package/docs/module-Helper.html +3 -0
- package/docs/module-Lib.html +3 -8
- package/docs/scripts/core.js +477 -476
- package/docs/scripts/resize.js +36 -36
- package/docs/scripts/search.js +105 -105
- package/docs/scripts/third-party/fuse.js +1 -1
- package/docs/scripts/third-party/hljs-line-num-original.js +285 -282
- package/docs/scripts/third-party/hljs-line-num.js +1 -1
- package/docs/scripts/third-party/hljs-original.js +1202 -1195
- package/docs/scripts/third-party/hljs.js +1 -1
- package/docs/scripts/third-party/popper.js +1 -1
- package/docs/scripts/third-party/tippy.js +1 -1
- package/docs/scripts/third-party/tocbot.js +509 -508
- package/index.js +8 -11
- package/lib/find-deep.js +3 -3
- package/lib/formats.js +17 -17
- package/lib/freeze.js +3 -3
- package/lib/import-module.js +8 -8
- package/package.json +1 -1
- package/test/app.test.js +183 -0
- package/test/bajo.test.js +125 -0
- package/test/base.test.js +74 -107
- package/test/cache.test.js +94 -0
- package/test/e2e.test.js +137 -0
- package/test/err.test.js +73 -0
- package/test/helper.test.js +39 -0
- package/test/import-module.test.js +138 -0
- package/test/integration.test.js +218 -0
- package/test/log.test.js +119 -0
- package/test/plugin.test.js +116 -0
- package/test/print.test.js +100 -0
- package/test/tools.test.js +38 -0
- package/wiki/CHANGES.md +5 -0
- package/.mocharc.json +0 -4
package/class/err.js
CHANGED
|
@@ -18,37 +18,40 @@ Error.stackTraceLimit = 15
|
|
|
18
18
|
*/
|
|
19
19
|
class Err extends Tools {
|
|
20
20
|
/**
|
|
21
|
-
* @param {Plugin} plugin
|
|
22
|
-
* @param {string} msg
|
|
23
|
-
* @param {...any} [args]
|
|
21
|
+
* @param {Plugin} plugin Plugin instance.
|
|
22
|
+
* @param {string} msg Error message.
|
|
23
|
+
* @param {...any} [args] Variables to interpolate with error message. Payload object can be pushed at the very last argument
|
|
24
24
|
*/
|
|
25
25
|
constructor (plugin, msg, ...args) {
|
|
26
26
|
super(plugin)
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* Error payload extracted from the last arguments
|
|
29
|
+
* Error payload extracted from the last arguments.
|
|
30
|
+
*
|
|
30
31
|
* @type {Object}
|
|
31
32
|
*/
|
|
32
33
|
this.payload = args.length > 0 && isPlainObject(args[args.length - 1]) ? args[args.length - 1] : {}
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
|
-
* Original message before translation
|
|
36
|
+
* Original message before translation.
|
|
37
|
+
*
|
|
36
38
|
* @type {string}
|
|
37
39
|
*/
|
|
38
40
|
this.orgMessage = msg
|
|
39
41
|
|
|
40
42
|
/**
|
|
41
|
-
* Translated message
|
|
43
|
+
* Translated message.
|
|
44
|
+
*
|
|
42
45
|
* @type {string}
|
|
43
46
|
*/
|
|
44
47
|
this.message = this.payload.noTrans ? msg : this.plugin.t(msg, ...args)
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
/**
|
|
48
|
-
* Write message to the console
|
|
51
|
+
* Write message to the console.
|
|
49
52
|
*
|
|
50
53
|
* @method
|
|
51
|
-
* @returns {Err} Error object,
|
|
54
|
+
* @returns {Err} Error object, useful for chaining.
|
|
52
55
|
*/
|
|
53
56
|
write = () => {
|
|
54
57
|
let err
|
|
@@ -78,7 +81,7 @@ class Err extends Tools {
|
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
/**
|
|
81
|
-
* Print instance on console and terminate process
|
|
84
|
+
* Print instance on console and terminate process.
|
|
82
85
|
*
|
|
83
86
|
* @method
|
|
84
87
|
*/
|
|
@@ -89,10 +92,10 @@ class Err extends Tools {
|
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
/**
|
|
92
|
-
* Pretty format error details
|
|
95
|
+
* Pretty format error details.
|
|
93
96
|
*
|
|
94
97
|
* @method
|
|
95
|
-
* @param {Object} value
|
|
98
|
+
* @param {Object} value Value to format.
|
|
96
99
|
* @returns {Object}
|
|
97
100
|
*/
|
|
98
101
|
formatErrorDetails = (value) => {
|
package/class/log.js
CHANGED
|
@@ -4,16 +4,16 @@ import chalk from 'chalk'
|
|
|
4
4
|
import { stripVTControlCharacters } from 'node:util'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Log output in stringified JSON format. Returned when app run in ```prod``` environment
|
|
7
|
+
* Log output in stringified JSON format. Returned when app run in ```prod``` environment.
|
|
8
8
|
*
|
|
9
9
|
* @typedef TLogJson
|
|
10
|
-
* @property {string} prefix
|
|
11
|
-
* @property {string} message
|
|
12
|
-
* @property {string} level
|
|
13
|
-
* @property {number} time
|
|
14
|
-
* @property {number} pid
|
|
15
|
-
* @property {string} hostname
|
|
16
|
-
* @property {Object} [data]
|
|
10
|
+
* @property {string} prefix Message prefix.
|
|
11
|
+
* @property {string} message The message itself.
|
|
12
|
+
* @property {string} level Log level.
|
|
13
|
+
* @property {number} time Time in millisecond.
|
|
14
|
+
* @property {number} pid Process ID.
|
|
15
|
+
* @property {string} hostname Hostname.
|
|
16
|
+
* @property {Object} [data] Payload data, if any.
|
|
17
17
|
* @see Log#formatMsg
|
|
18
18
|
*/
|
|
19
19
|
|
|
@@ -44,7 +44,8 @@ class Log {
|
|
|
44
44
|
constructor (app) {
|
|
45
45
|
this.lastDelta = 0
|
|
46
46
|
/**
|
|
47
|
-
* The app instance
|
|
47
|
+
* The app instance.
|
|
48
|
+
*
|
|
48
49
|
* @type {App}
|
|
49
50
|
*/
|
|
50
51
|
this.app = app
|
|
@@ -63,9 +64,9 @@ class Log {
|
|
|
63
64
|
* In ```prod``` environment, log will be delivered as JSON stringified object. See {@link TLogJson} for more info
|
|
64
65
|
*
|
|
65
66
|
* @method
|
|
66
|
-
* @param {string} level
|
|
67
|
-
* @param {string} prefix
|
|
68
|
-
* @param {...any} params
|
|
67
|
+
* @param {string} level Log level to use.
|
|
68
|
+
* @param {string} prefix Prefix to the message.
|
|
69
|
+
* @param {...any} params See format above.
|
|
69
70
|
* @see Err
|
|
70
71
|
* @see TLogJson
|
|
71
72
|
*/
|
|
@@ -126,11 +127,11 @@ class Log {
|
|
|
126
127
|
}
|
|
127
128
|
|
|
128
129
|
/**
|
|
129
|
-
* Calculate pattern used for log rotation
|
|
130
|
+
* Calculate pattern used for log rotation.
|
|
130
131
|
*
|
|
131
132
|
* @method
|
|
132
|
-
* @param {boolean} isPrev
|
|
133
|
-
* @returns {string} Calculated pattern
|
|
133
|
+
* @param {boolean} isPrev If true, calculate previous rotation pattern.
|
|
134
|
+
* @returns {string} Calculated pattern.
|
|
134
135
|
*/
|
|
135
136
|
getRotationPattern = (isPrev) => {
|
|
136
137
|
const { dayjs } = this.app.lib
|
|
@@ -159,11 +160,11 @@ class Log {
|
|
|
159
160
|
}
|
|
160
161
|
|
|
161
162
|
/**
|
|
162
|
-
* Save log to file in {dataDir}/log
|
|
163
|
+
* Save log to file in {dataDir}/log.
|
|
163
164
|
*
|
|
164
165
|
* @method
|
|
165
|
-
* @param {string} text
|
|
166
|
-
* @param {string} prefix
|
|
166
|
+
* @param {string} text Log message to save.
|
|
167
|
+
* @param {string} prefix Use prefix as basename. Defaults to 'bajo'.
|
|
167
168
|
*/
|
|
168
169
|
save = (text, prefix = 'bajo') => {
|
|
169
170
|
const { fs } = this.app.lib
|
|
@@ -179,84 +180,84 @@ class Log {
|
|
|
179
180
|
}
|
|
180
181
|
|
|
181
182
|
/**
|
|
182
|
-
* Display & format message in ```trace``` level. See {@link Log#formatMsg|formatMsg} for details
|
|
183
|
+
* Display & format message in ```trace``` level. See {@link Log#formatMsg|formatMsg} for details.
|
|
183
184
|
*
|
|
184
185
|
* @method
|
|
185
|
-
* @param {string} prefix
|
|
186
|
-
* @param {...any} params
|
|
186
|
+
* @param {string} prefix Message prefix.
|
|
187
|
+
* @param {...any} params Parameters.
|
|
187
188
|
*/
|
|
188
189
|
trace = (prefix, ...params) => {
|
|
189
190
|
this.formatMsg('trace', prefix, ...params)
|
|
190
191
|
}
|
|
191
192
|
|
|
192
193
|
/**
|
|
193
|
-
* Display & format message in ```debug``` level. See {@link Log#formatMsg|formatMsg} for details
|
|
194
|
+
* Display & format message in ```debug``` level. See {@link Log#formatMsg|formatMsg} for details.
|
|
194
195
|
*
|
|
195
196
|
* @method
|
|
196
|
-
* @param {string} prefix
|
|
197
|
-
* @param {...any} params
|
|
197
|
+
* @param {string} prefix Message prefix.
|
|
198
|
+
* @param {...any} params Parameters.
|
|
198
199
|
*/
|
|
199
200
|
debug = (prefix, ...params) => {
|
|
200
201
|
this.formatMsg('debug', prefix, ...params)
|
|
201
202
|
}
|
|
202
203
|
|
|
203
204
|
/**
|
|
204
|
-
* Display & format message in ```info``` level. See {@link Log#formatMsg|formatMsg} for details
|
|
205
|
+
* Display & format message in ```info``` level. See {@link Log#formatMsg|formatMsg} for details.
|
|
205
206
|
*
|
|
206
207
|
* @method
|
|
207
|
-
* @param {string} prefix
|
|
208
|
-
* @param {...any} params
|
|
208
|
+
* @param {string} prefix Message prefix.
|
|
209
|
+
* @param {...any} params Parameters.
|
|
209
210
|
*/
|
|
210
211
|
info = (prefix, ...params) => {
|
|
211
212
|
this.formatMsg('info', prefix, ...params)
|
|
212
213
|
}
|
|
213
214
|
|
|
214
215
|
/**
|
|
215
|
-
* Display & format message in ```warn``` level. See {@link Log#formatMsg|formatMsg} for details
|
|
216
|
+
* Display & format message in ```warn``` level. See {@link Log#formatMsg|formatMsg} for details.
|
|
216
217
|
*
|
|
217
218
|
* @method
|
|
218
|
-
* @param {string} prefix
|
|
219
|
-
* @param {...any} params
|
|
219
|
+
* @param {string} prefix Message prefix.
|
|
220
|
+
* @param {...any} params Parameters.
|
|
220
221
|
*/
|
|
221
222
|
warn = (prefix, ...params) => {
|
|
222
223
|
this.formatMsg('warn', prefix, ...params)
|
|
223
224
|
}
|
|
224
225
|
|
|
225
226
|
/**
|
|
226
|
-
* Display & format message in ```error``` level. See {@link Log#formatMsg|formatMsg} for details
|
|
227
|
+
* Display & format message in ```error``` level. See {@link Log#formatMsg|formatMsg} for details.
|
|
227
228
|
*
|
|
228
229
|
* @method
|
|
229
|
-
* @param {string} prefix
|
|
230
|
-
* @param {...any} params
|
|
230
|
+
* @param {string} prefix Message prefix.
|
|
231
|
+
* @param {...any} params Parameters.
|
|
231
232
|
*/
|
|
232
233
|
error = (prefix, ...params) => {
|
|
233
234
|
this.formatMsg('error', prefix, ...params)
|
|
234
235
|
}
|
|
235
236
|
|
|
236
237
|
/**
|
|
237
|
-
* Display & format message in ```fatal``` level. See {@link Log#formatMsg|formatMsg} for details
|
|
238
|
+
* Display & format message in ```fatal``` level. See {@link Log#formatMsg|formatMsg} for details.
|
|
238
239
|
*
|
|
239
240
|
* @method
|
|
240
|
-
* @param {string} prefix
|
|
241
|
-
* @param {...any} params
|
|
241
|
+
* @param {string} prefix Message prefix.
|
|
242
|
+
* @param {...any} params Parameters.
|
|
242
243
|
*/
|
|
243
244
|
fatal = (prefix, ...params) => {
|
|
244
245
|
this.formatMsg('fatal', prefix, ...params)
|
|
245
246
|
}
|
|
246
247
|
|
|
247
248
|
/**
|
|
248
|
-
* Display & format message in ```silent``` level. See {@link Log#formatMsg|formatMsg} for details
|
|
249
|
+
* Display & format message in ```silent``` level. See {@link Log#formatMsg|formatMsg} for details.
|
|
249
250
|
*
|
|
250
251
|
* @method
|
|
251
|
-
* @param {string} prefix
|
|
252
|
-
* @param {...any} params
|
|
252
|
+
* @param {string} prefix Message prefix.
|
|
253
|
+
* @param {...any} params Parameters.
|
|
253
254
|
*/
|
|
254
255
|
silent = (prefix, ...params) => {
|
|
255
256
|
this.formatMsg('silent', prefix, ...params)
|
|
256
257
|
}
|
|
257
258
|
|
|
258
259
|
/**
|
|
259
|
-
* Dispose internal references
|
|
260
|
+
* Dispose internal references.
|
|
260
261
|
*/
|
|
261
262
|
dispose = async () => {
|
|
262
263
|
this.app = null
|
package/class/plugin.js
CHANGED
|
@@ -8,19 +8,19 @@ const { get, isEmpty, cloneDeep, omit, isPlainObject, camelCase } = lodash
|
|
|
8
8
|
* respectfully.
|
|
9
9
|
*
|
|
10
10
|
* There are currently only two main plugins available:
|
|
11
|
-
* - {@link Bajo} - Core plugin class, responsible for system wide setup and boot process. You should not touch this obviously
|
|
12
|
-
* - {@link Base} - Base plugin class your own plugin should
|
|
11
|
+
* - {@link Bajo} - Core plugin class, responsible for system wide setup and boot process. You should not touch this obviously.
|
|
12
|
+
* - {@link Base} - Base plugin class your own plugin should inherite from.
|
|
13
13
|
*
|
|
14
14
|
* @class
|
|
15
15
|
*/
|
|
16
16
|
class Plugin {
|
|
17
17
|
/**
|
|
18
|
-
* @param {string} pkgName
|
|
19
|
-
* @param {Object} app
|
|
18
|
+
* @param {string} pkgName Package name (the one you use in package.json).
|
|
19
|
+
* @param {Object} app App instance reference. Usefull to call app method inside a plugin.
|
|
20
20
|
*/
|
|
21
21
|
constructor (pkgName, app) {
|
|
22
22
|
/**
|
|
23
|
-
* Package name, the one from package.json
|
|
23
|
+
* Package name, the one from package.json.
|
|
24
24
|
*
|
|
25
25
|
* @memberof Plugin
|
|
26
26
|
* @constant {string}
|
|
@@ -28,7 +28,7 @@ class Plugin {
|
|
|
28
28
|
this.pkgName = pkgName
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
* Namespace (ns) or plugin's name. Simply the camel cased version of plugin's package name
|
|
31
|
+
* Namespace (ns) or plugin's name. Simply the camel cased version of plugin's package name.
|
|
32
32
|
*
|
|
33
33
|
* @memberof Plugin
|
|
34
34
|
* @constant {string}
|
|
@@ -37,7 +37,7 @@ class Plugin {
|
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Plugin alias. Derived plugin must provide its own, unique alias. If it left blank,
|
|
40
|
-
* Bajo will provide this automatically (by using the kebab-cased version of plugin name)
|
|
40
|
+
* Bajo will provide this automatically (by using the kebab-cased version of plugin name).
|
|
41
41
|
*
|
|
42
42
|
* @readonly
|
|
43
43
|
* @memberof Plugin
|
|
@@ -46,14 +46,14 @@ class Plugin {
|
|
|
46
46
|
this.alias = null
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
|
-
* Reference to app instance
|
|
49
|
+
* Reference to the app instance.
|
|
50
50
|
*
|
|
51
51
|
* @type {Object}
|
|
52
52
|
*/
|
|
53
53
|
this.app = app
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
|
-
* Config object
|
|
56
|
+
* Config object.
|
|
57
57
|
*
|
|
58
58
|
* @type {Object}
|
|
59
59
|
* @see {@tutorial config}
|
|
@@ -61,7 +61,7 @@ class Plugin {
|
|
|
61
61
|
this.config = {}
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
|
-
* Shortcut to {@link App#log} with prefix parameter set to this plugin
|
|
64
|
+
* Shortcut to {@link App#log} with prefix parameter set to this plugin namespace.
|
|
65
65
|
*
|
|
66
66
|
* @type {Log}
|
|
67
67
|
*/
|
|
@@ -77,11 +77,11 @@ class Plugin {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
|
-
* Get package info
|
|
80
|
+
* Get package info.
|
|
81
81
|
*
|
|
82
82
|
* @method
|
|
83
|
-
* @param {string} [dir]
|
|
84
|
-
* @param {Array} [keys=['name', 'version', 'description', 'author', 'license', 'homepage', 'bajo']]
|
|
83
|
+
* @param {string} [dir] Package directory. Defaults to the current plugin's package dir.
|
|
84
|
+
* @param {Array} [keys=['name', 'version', 'description', 'author', 'license', 'homepage', 'bajo']] Field keys to be use. Set empty to use all keys.
|
|
85
85
|
*/
|
|
86
86
|
getPkgInfo = (dir, keys = ['name', 'version', 'description', 'author', 'license', 'homepage', 'bajo']) => {
|
|
87
87
|
const { pick, isEmpty } = this.app.lib._
|
|
@@ -92,15 +92,15 @@ class Plugin {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
|
-
* Get plugin's config value
|
|
95
|
+
* Get plugin's config value.
|
|
96
96
|
*
|
|
97
97
|
* @method
|
|
98
|
-
* @param {string} [path]
|
|
99
|
-
* @param {Object} [options={}]
|
|
100
|
-
* @param {any} [options.defValue={}]
|
|
101
|
-
* @param {string[]} [options.omit=[]]
|
|
102
|
-
* @param {boolean} [options.noClone=false]
|
|
103
|
-
* @returns {Object} Returned object. If no path provided, the whole config object is returned
|
|
98
|
+
* @param {string} [path] dot separated config path (think of lodash's 'get'). If not provided, the full config will be given.
|
|
99
|
+
* @param {Object} [options={}] Options.
|
|
100
|
+
* @param {any} [options.defValue={}] Default value to use if returned object is undefined.
|
|
101
|
+
* @param {string[]} [options.omit=[]] Omit these keys from returned object.
|
|
102
|
+
* @param {boolean} [options.noClone=false] Set true to NOT clone returned object.
|
|
103
|
+
* @returns {Object} Returned object. If no path provided, the whole config object is returned.
|
|
104
104
|
*/
|
|
105
105
|
getConfig = (path, options = {}) => {
|
|
106
106
|
let obj = isEmpty(path) ? this.config : get(this.config, path, options.defValue ?? {})
|
|
@@ -111,12 +111,12 @@ class Plugin {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
/**
|
|
114
|
-
* Create an instance of {@link Err} object
|
|
114
|
+
* Create an instance of {@link Err} object.
|
|
115
115
|
*
|
|
116
116
|
* @method
|
|
117
|
-
* @param {
|
|
118
|
-
* @param {...any} [args]
|
|
119
|
-
* @returns {Object} Err instance
|
|
117
|
+
* @param {string} msg Error message.
|
|
118
|
+
* @param {...any} [args] Argument variables you might want to add to the error object.
|
|
119
|
+
* @returns {Object} Err instance.
|
|
120
120
|
*/
|
|
121
121
|
error = (msg, ...args) => {
|
|
122
122
|
if (!this.print) return new Error(msg, ...args)
|
|
@@ -126,11 +126,11 @@ class Plugin {
|
|
|
126
126
|
|
|
127
127
|
/**
|
|
128
128
|
* Create an instance of Err object, display it on screen and then force
|
|
129
|
-
* terminate the app process
|
|
129
|
+
* terminate the app process.
|
|
130
130
|
*
|
|
131
131
|
* @method
|
|
132
|
-
* @param {
|
|
133
|
-
* @param {...any} [args]
|
|
132
|
+
* @param {string} msg Error message.
|
|
133
|
+
* @param {...any} [args] Argument variables you might want to add to the error object.
|
|
134
134
|
*/
|
|
135
135
|
fatal = (msg, ...args) => {
|
|
136
136
|
if (!this.print) return new Error(msg, ...args)
|
|
@@ -143,8 +143,8 @@ class Plugin {
|
|
|
143
143
|
*
|
|
144
144
|
* Shortcut to {@link App#t} with ns parameter set to this plugin namespace.
|
|
145
145
|
*
|
|
146
|
-
* @param {string} text
|
|
147
|
-
* @param {...any} params
|
|
146
|
+
* @param {string} text Text to translate.
|
|
147
|
+
* @param {...any} params Variables to interpolate to ```text```.
|
|
148
148
|
* @returns {string}
|
|
149
149
|
*/
|
|
150
150
|
t = (text, ...params) => {
|
|
@@ -156,8 +156,8 @@ class Plugin {
|
|
|
156
156
|
*
|
|
157
157
|
* Shortcut to {@link App#te} with ns parameter set to this plugin namespace.
|
|
158
158
|
*
|
|
159
|
-
* @param {string} text
|
|
160
|
-
* @param {...any} params
|
|
159
|
+
* @param {string} text Text to translate.
|
|
160
|
+
* @param {...any} params Variables to interpolate to ```text```.
|
|
161
161
|
* @returns {string}
|
|
162
162
|
*/
|
|
163
163
|
te = (text, ...params) => {
|
|
@@ -165,9 +165,9 @@ class Plugin {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
|
-
* Force bind methods to self (```this```)
|
|
168
|
+
* Force bind methods to self (```this```).
|
|
169
169
|
*
|
|
170
|
-
* @param {string[]} names
|
|
170
|
+
* @param {string[]} names Method's names.
|
|
171
171
|
*/
|
|
172
172
|
selfBind (names) {
|
|
173
173
|
if (!Array.isArray(names)) names = [names]
|
|
@@ -177,17 +177,16 @@ class Plugin {
|
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
/**
|
|
180
|
-
* Alias to ```this.app.dump()
|
|
180
|
+
* Alias to ```this.app.dump()```.
|
|
181
181
|
*
|
|
182
182
|
* @param {...any} args
|
|
183
|
-
* @returns
|
|
184
183
|
*/
|
|
185
184
|
dump = (...args) => {
|
|
186
185
|
this.app.dump(...args)
|
|
187
186
|
}
|
|
188
187
|
|
|
189
188
|
/**
|
|
190
|
-
* Dispose internal references
|
|
189
|
+
* Dispose internal references.
|
|
191
190
|
*/
|
|
192
191
|
dispose = async () => {
|
|
193
192
|
this.app = null
|