unprint 0.18.29 → 0.18.30
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/README.md +16 -1
- package/package.json +1 -1
- package/src/app.js +6 -0
package/README.md
CHANGED
|
@@ -271,6 +271,17 @@ Returns
|
|
|
271
271
|
}
|
|
272
272
|
```
|
|
273
273
|
|
|
274
|
+
### Helpers
|
|
275
|
+
* `initialize(source, [selector], [options])` (`init`): Initialize element or HTML as unprint context
|
|
276
|
+
* `initializeAll(source, [selector], [options])` (`initAll`): Initialize element or HTML as multiple contexts
|
|
277
|
+
* `extractDate(string, [format], [options])`: Parse date with moment and some curation
|
|
278
|
+
* `extractDateAgo(string, [options])`: Extract relative date (e.g. 4 months ago)
|
|
279
|
+
* `extractDuration(timestamp, [matchRegex])`: Parse duration (e.g. 04:11:05) to seconds
|
|
280
|
+
* `extractTimestamp(string)`: Parse timestamp (e.g. 4H11M5S) to seconds
|
|
281
|
+
* `extractNumber(string, [options])`: Parse string as number
|
|
282
|
+
* `extractSourceSet(string, [options])`: Parse source set to object
|
|
283
|
+
* `formatDate(date, format, inputFormat)`: Format date with moment
|
|
284
|
+
|
|
274
285
|
### Proxy
|
|
275
286
|
```javascript
|
|
276
287
|
unprint.options({ // or unprint.options();
|
|
@@ -300,7 +311,11 @@ Usage:
|
|
|
300
311
|
* `unprint.off('trigger', callbackFn)`
|
|
301
312
|
|
|
302
313
|
Triggers:
|
|
314
|
+
* `query`: A query method was used
|
|
303
315
|
* `requestInit`: A HTTP request is about to be made
|
|
304
316
|
* `requestSuccess`: The HTTP request completed with an OK status code
|
|
305
317
|
* `requestError`: The HTTP request completed with an error status code
|
|
306
|
-
* `
|
|
318
|
+
* `browserOpen`: A browser window was launched or used
|
|
319
|
+
* `browserClose`: A browser window was closed
|
|
320
|
+
* `controlSuccess`: A browser call control method succeeded
|
|
321
|
+
* `controlError`: A browser call control method failed
|
package/package.json
CHANGED
package/src/app.js
CHANGED
|
@@ -1426,6 +1426,11 @@ async function browserRequest(url, customOptions = {}) {
|
|
|
1426
1426
|
|
|
1427
1427
|
await closeBrowser(client, options);
|
|
1428
1428
|
|
|
1429
|
+
events.emit('controlError', {
|
|
1430
|
+
...feedbackBase,
|
|
1431
|
+
error,
|
|
1432
|
+
});
|
|
1433
|
+
|
|
1429
1434
|
return {
|
|
1430
1435
|
ok: false,
|
|
1431
1436
|
controlError: error.message,
|
|
@@ -1628,6 +1633,7 @@ module.exports = {
|
|
|
1628
1633
|
extractDateAgo,
|
|
1629
1634
|
extractDuration,
|
|
1630
1635
|
extractNumber,
|
|
1636
|
+
extractSourceSet,
|
|
1631
1637
|
extractTimestamp,
|
|
1632
1638
|
formatDate,
|
|
1633
1639
|
dateConstants: {
|