1# Distributed Scheduler Subsystem ChangeLog
2
3## cl.DistributedManagerService.1 continuationManager API Changes
4
5- Event names passed to the **continuationManager** API do not comply with the OpenHarmony API specifications.
6- The **continuationManager.on** API does not have a unified return value for various events, which does not comply with the OpenHarmony API specifications.
7
8The following changes have been made:
9
10- The device selection event name of **continuationManager.on** and **continuationManager.off** is changed from **deviceConnect** to **deviceSelected**, and the device deselection event name is changed from **deviceDisconnect** to **deviceUnselected**.
11- The **continuationManager.on** API returns **Callback<Array<ContinuationResult>>** for all events.
12
13**Change Impacts**
14
15The application developed based on earlier versions needs to adapt the new APIs. Otherwise, the original service logic will be affected.
16
17**Key API/Component Changes**
18
19- Involved APIs:
20
21  continuationManager.on;
22  continuationManager.off;
23
24- Before change:
25
26```js
27  function on(type: "deviceConnect", token: number, callback: Callback<Array<ContinuationResult>>): void;
28  function off(type: "deviceConnect", token: number): void;
29  function on(type: "deviceDisconnect", token: number, callback: Callback<Array<string>>): void;
30  function off(type: "deviceDisconnect", token: number): void;
31```
32
33- After change:
34
35```js
36  function on(type: "deviceSelected", token: number, callback: Callback<Array<ContinuationResult>>): void;
37  function off(type: "deviceSelected", token: number): void;
38  function on(type: "deviceUnselected", token: number, callback: Callback<Array<ContinuationResult>>): void;
39  function off(type: "deviceUnselected", token: number): void;
40```
41
42**Adaptation Guide**
43
44Change the event names. The sample code is as follows:
45
46Device selection event of **continuationManager.on**:
47
48```ts
49  let token = 1;
50  try {
51    continuationManager.on("deviceSelected", token, (data) => {
52      console.info('onDeviceSelected len: ' + data.length);
53      for (let i = 0; i < data.length; i++) {
54        console.info('onDeviceSelected deviceId: ' + JSON.stringify(data[i].id));
55        console.info('onDeviceSelected deviceType: ' + JSON.stringify(data[i].type));
56        console.info('onDeviceSelected deviceName: ' + JSON.stringify(data[i].name));
57      }
58    });
59  } catch (err) {
60    console.error('on failed, cause: ' + JSON.stringify(err));
61  }
62```
63
64Device selection event of **continuationManager.off**:
65
66```ts
67  let token = 1;
68  try {
69    continuationManager.off("deviceSelected", token);
70  } catch (err) {
71    console.error('off failed, cause: ' + JSON.stringify(err));
72  }
73```
74
75Device deselection event of **continuationManager.on**:
76
77```ts
78  let token = 1;
79  try {
80    continuationManager.on("deviceUnselected", token, (data) => {
81      console.info('onDeviceUnselected len: ' + data.length);
82      for (let i = 0; i < data.length; i++) {
83        console.info('onDeviceUnselected deviceId: ' + JSON.stringify(data[i].id));
84        console.info('onDeviceUnselected deviceType: ' + JSON.stringify(data[i].type));
85        console.info('onDeviceUnselected deviceName: ' + JSON.stringify(data[i].name));
86      }
87      console.info('onDeviceUnselected finished.');
88    });
89  } catch (err) {
90    console.error('on failed, cause: ' + JSON.stringify(err));
91  }
92```
93
94Device deselection event of **continuationManager.off**:
95
96```ts
97  let token = 1;
98  try {
99    continuationManager.off("deviceUnselected", token);
100  } catch (err) {
101    console.error('off failed, cause: ' + JSON.stringify(err));
102  }
103```
104