You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `setStateAsync` method has been deprecated in favor of the synchronous `setState` method. Newly created adapters will now use the current recommended API. If you have an existing adapter using `setStateAsync`, you should update it to use `setState` instead.
3
+
The `setStateAsync` method has been deprecated in favor of the `setState` method. Newly created adapters will now use the current recommended API. If you have an existing adapter using `setStateAsync`, you should update it to use `setState` instead.
4
4
5
5
## What changed
6
6
7
-
The adapter template generation was updated to use `this.setState()` instead of `await this.setStateAsync()` for setting states.
7
+
The adapter template generation was updated to use `await this.setState()` instead of `await this.setStateAsync()` for setting states.
8
8
9
9
## Manual migration for existing adapters
10
10
11
-
If you have an existing adapter that uses `setStateAsync`, you should replace all occurrences with the synchronous `setState` method:
11
+
If you have an existing adapter that uses `setStateAsync`, you should replace all occurrences with the `setState` method:
12
12
13
13
```diff
14
14
// Before (deprecated)
@@ -17,18 +17,18 @@ If you have an existing adapter that uses `setStateAsync`, you should replace al
The `setStateAsync` method was deprecated because:
28
-
-`setState`is now synchronous and doesn't return a Promise
29
-
-Using the synchronous version is simpler and more efficient
30
-
-It aligns with current ioBroker adapter development best practices
27
+
The `setStateAsync` method was deprecated in favor of the simpler `setState` method:
28
+
-`setState`when called without a callback returns a Promise and should be awaited
29
+
-`setState` when called with a callback is synchronous
30
+
-Using `setState` aligns with current ioBroker adapter development best practices
31
31
32
32
## No functional changes
33
33
34
-
This change does not affect the functionality of your adapter - both methods perform the same operation. The only difference is that `setState` is synchronous and doesn't need to be awaited.
34
+
This change does not affect the functionality of your adapter - both methods perform the same operation. The only difference is using the current recommended API instead of the deprecated one.
0 commit comments