Skip to content

Commit 4668ffb

Browse files
authored
Update docs for release v2.25
2 parents 528cb3d + a8e770e commit 4668ffb

File tree

12 files changed

+1225
-911
lines changed

12 files changed

+1225
-911
lines changed

.vuepress/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ module.exports = {
5353
],
5454
},
5555
"modules/customcss",
56+
"modules/animate"
5657
],
5758
},
5859
{

development/core-module-file.md

Lines changed: 70 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ will return the user's configured header.
229229
If you want to use the original user's configured header, reference
230230
`this.data.header`.
231231

232-
**NOTE:** If the user did not configure a default header, no header will be
232+
**Note:** If the user did not configure a default header, no header will be
233233
displayed and thus this method will not be called.
234234

235235
**Example:**
@@ -283,7 +283,8 @@ When this module is called, it has 2 arguments:
283283
- `payload` - AnyType - The payload of a notification.
284284

285285
**Note 1:** When a node helper sends a notification, all modules of that module
286-
type receive the same notifications. <br> **Note 2:** The socket connection is
286+
type receive the same notifications.<br>
287+
**Note 2:** The socket connection is
287288
established as soon as the module sends its first message using
288289
[sendSocketNotification](#this-sendsocketnotification-notification-payload).
289290

@@ -315,14 +316,15 @@ module.
315316
### `this.file(filename)`
316317

317318
**_filename_ String** - The name of the file you want to create the path
318-
for.<br> **Returns String**
319+
for.<br>
320+
**Returns String**
319321

320322
If you want to create a path to a file in your module folder, use the `file()`
321323
method. It returns the path to the filename given as the attribute. Is method
322324
comes in handy when configuring the [getScripts](#getscripts) and
323325
[getStyles](#getstyles) methods.
324326

325-
### `this.updateDom(speed)`
327+
### `this.updateDom(speed|options)`
326328

327329
**_speed_ Number** - Optional. Animation speed in milliseconds.<br>
328330

@@ -343,10 +345,40 @@ start: function() {
343345
...
344346
```
345347

348+
**_options_ Object** - (_Introduced in version: 2.25.0._) Optional. Allows you to determine the animation speed and animation type options, whenever your module needs to be updated
349+
350+
| options | type | description |
351+
| ------- | ---- | ----------- |
352+
| speed | Number | animation speed in ms |
353+
| animate | Object | animate IN and OUT rules (see below) |
354+
355+
356+
**animate Object**
357+
358+
| animate | type | description |
359+
| ------- | ---- | ----------- |
360+
| in | String | Animate name when module will be shown (after dom update), it will use an `animateIn` type name (see [Animation Guide](../modules/animate#animatein)) |
361+
| out | String | Animate name when module will be hidden (before dom update), it will use an `animateOut` type name (see [Animation Guide](../modules/animate#animateout)) |
362+
363+
As an example:
364+
```javascript
365+
...
366+
this.updateDom( {
367+
options: {
368+
speed: 1000, // animation duration
369+
animate: {
370+
in: "backInDown", // animation when module shown (after update)
371+
out: "backOutUp" // animatation when module will hide (before update)
372+
}
373+
}
374+
})
375+
...
376+
```
377+
346378
### `this.sendNotification(notification, payload)`
347379

348-
**_notification_ String** - The notification identifier.<br> **_payload_
349-
AnyType** - Optional. A notification payload.<br>
380+
**_notification_ String** - The notification identifier.<br>
381+
**_payload_ AnyType** - Optional. A notification payload.
350382

351383
If you want to send a notification to all other modules, use the
352384
`sendNotification(notification, payload)`. All other modules will receive the
@@ -363,8 +395,8 @@ this.sendNotification("MYMODULE_READY_FOR_ACTION", { foo: bar });
363395

364396
### `this.sendSocketNotification(notification, payload)`
365397

366-
**_notification_ String** - The notification identifier.<br> **_payload_
367-
AnyType** - Optional. A notification payload.<br>
398+
**_notification_ String** - The notification identifier.<br>
399+
**_payload_ AnyType** - Optional. A notification payload.
368400

369401
If you want to send a notification to the node_helper, use the
370402
`sendSocketNotification(notification, payload)`. Only the node_helper of this
@@ -379,10 +411,9 @@ this.sendSocketNotification("SET_CONFIG", this.config);
379411
### `this.hide(speed, callback, options)`
380412

381413
**_speed_ Number** - Optional (Required when setting callback or options), The
382-
speed of the hide animation in milliseconds. **_callback_ Function** - Optional,
383-
The callback after the hide animation is finished. **_options_ Function** -
384-
Optional, Object with additional options for the hide action (see below).
385-
(_Introduced in version: 2.1.0._)
414+
speed of the hide animation in milliseconds.<br>
415+
**_callback_ Function** - Optional, The callback after the hide animation is finished.<br>
416+
**_options_ Function** - Optional, Object with additional options for the hide action (see below). (_Introduced in version: 2.1.0._)
386417

387418
To hide a module, you can call the `hide(speed, callback)` method. You can call
388419
the hide method on the module instance itself using `this.hide()`, but of course
@@ -396,21 +427,23 @@ Possible configurable options:
396427
modules identifier as the locksString: `this.identifier`. See _visibility
397428
locking_ below.
398429

399-
**Note 1:** If the hide animation is cancelled, for instance because the show
430+
- `animate` - String - (_Introduced in version: 2.25.0._) Hide the module with a special animate. It will use an `animateOut` type name. All animations name are available in [Animation Guide](../modules/animate.html#animateout)
431+
432+
::: warning Notes:
433+
- If the hide animation is cancelled, for instance because the show
400434
method is called before the hide animation was finished, the callback will not
401-
be called.<br> **Note 2:** If the hide animation is hijacked (an other method
402-
calls hide on the same module), the callback will not be called.<br> **Note 3:**
403-
If the dom is not yet created, the hide method won't work. Wait for the
404-
`DOM_OBJECTS_CREATED`
405-
[notification](#notificationreceived-notification-payload-sender).
435+
be called.<br>
436+
- If the hide animation is hijacked (an other method calls hide on the same module),the callback will not be called.<br>
437+
- If the dom is not yet created, the hide method won't work. Wait for the
438+
`DOM_OBJECTS_CREATED` [notification](#notificationreceived-notification-payload-sender).<br>
439+
- If an `animateOut` is defined in global module configuration, `animate` string will be ignored
440+
:::
406441

407442
### `this.show(speed, callback, options)`
408443

409-
**_speed_ Number** - Optional (Required when setting callback or options), The
410-
speed of the show animation in milliseconds. **_callback_ Function** - Optional,
411-
The callback after the show animation is finished. **_options_ Function** -
412-
Optional, Object with additional options for the show action (see below).
413-
(_Introduced in version: 2.1.0._)
444+
**_speed_ Number** - Optional (Required when setting callback or options), The speed of the show animation in milliseconds.<br>
445+
**_callback_ Function** - Optional, The callback after the show animation is finished.<br>
446+
**_options_ Function** - Optional, Object with additional options for the show action (see below). (_Introduced in version: 2.1.0._)
414447

415448
To show a module, you can call the `show(speed, callback)` method. You can call
416449
the show method on the module instance itself using `this.show()`, but of course
@@ -428,14 +461,18 @@ Possible configurable options:
428461
- `onError(error)` - Function - If a module is hidden with other lock strings
429462
and can therefore not be shown the onError callback triggers with an error
430463
object, if specified in the options (_Introduced in version: 2.15.0_).
464+
- `animate` - String - (_Introduced in version: 2.25.0._) Show the module with a special animation. It will use an `animateIn` type name. All animations name are available in [Animation Guide](../modules/animate.html#animatein)
431465

432-
**Note 1:** If the show animation is canceled, for instance because the hide
466+
::: warning Notes:
467+
- If the show animation is canceled, for instance because the hide
433468
method is called before the show animation was finished, the callback will not
434-
be called.<br> **Note 2:** If the show animation is hijacked (an other method
435-
calls show on the same module), the callback will not be called.<br> **Note 3:**
436-
If the dom is not yet created, the show method won't work. Wait for the
437-
`DOM_OBJECTS_CREATED`
438-
[notification](#notificationreceived-notification-payload-sender).
469+
be called.<br>
470+
- If the show animation is hijacked (an other method
471+
calls show on the same module), the callback will not be called.<br>
472+
- If the dom is not yet created, the show method won't work. Wait for the
473+
`DOM_OBJECTS_CREATED` [notification](#notificationreceived-notification-payload-sender).<br>
474+
- If an `animateIn` is defined in global module configuration, `animate` string will be ignored
475+
:::
439476

440477
### Visibility locking
441478

@@ -559,7 +596,7 @@ Comments in translation files could help other translators.
559596

560597
#### `this.translate(identifier, variables)`
561598

562-
**_identifier_ String** - Identifier of the string that should be translated.
599+
**_identifier_ String** - Identifier of the string that should be translated.<br>
563600
**_variables_ Object** - Object of variables to be used in translation.
564601

565602
This improved and backwards compatible way to handle translations behaves like
@@ -574,15 +611,15 @@ var timeUntilEnd = moment(event.endDate, "x").fromNow(true);
574611
this.translate("RUNNING", { "timeUntilEnd": timeUntilEnd) }); // Will return a translated string for the identifier RUNNING, replacing `{timeUntilEnd}` with the contents of the variable `timeUntilEnd` in the order that translator intended.
575612
```
576613

577-
**Example English .json file:**
614+
**Example English.json file:**
578615

579616
```javascript
580617
{
581618
"RUNNING": "Ends in {timeUntilEnd}",
582619
}
583620
```
584621

585-
**Example Finnish .json file:**
622+
**Example Finnish.json file:**
586623

587624
```javascript
588625
{
@@ -605,7 +642,7 @@ this.translate("RUNNING", {
605642
)}); // Will return a translated string for the identifier RUNNING, replacing `{timeUntilEnd}` with the contents of the variable `timeUntilEnd` in the order that translator intended. (has a fallback)
606643
```
607644

608-
**Example Swedish .json file that does not have the variable in it:**
645+
**Example Swedish.json file that does not have the variable in it:**
609646

610647
```javascript
611648
{

development/node-helper.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,12 @@ module.
147147

148148
### `this.sendSocketNotification(notification, payload)`
149149

150-
**_notification_ String** - The notification identifier.<br> **_payload_
151-
AnyType** - Optional. A notification payload.<br>
150+
**_notification_ String** - The notification identifier.<br>
151+
**_payload_ AnyType** - Optional. A notification payload.
152152

153-
If you want to send a notification to all your modules, use the
154-
`sendSocketNotification(notification, payload)`. Only the module of your module
155-
type will receive the socket notification.
153+
If you want to send a notification to your module, use the
154+
`sendSocketNotification(notification, payload)`.<br>
155+
Only the module of your module type will receive the socket notification.
156156

157157
**Note:** Since all instances of your module will receive the notifications,
158158
it's your task to make sure the right module responds to your messages.
@@ -163,6 +163,10 @@ it's your task to make sure the right module responds to your messages.
163163
this.sendSocketNotification("SET_CONFIG", this.config);
164164
```
165165

166+
::: warning Reminder
167+
`sendSocketNotification` sends a notification from the helper to all the instances of your module.
168+
:::
169+
166170
## Using native node modules in your node_helper
167171

168172
If you want use `native node modules` within electron you need to recompile them

getting-started/requirements.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,7 @@ Raspberry Pi OS versions based on Debian "Stretch" are also no longer supported.
3030

3131
## Node
3232

33-
Node 18 is required, all older versions have reached end of life and will not
33+
::: warning NOTE Node 18 is required!
34+
All older versions (Node 16 and below) have reached end of life and will not
3435
work.
36+
:::

0 commit comments

Comments
 (0)