提交 abe4c0d4 编写于 作者: C c00382521

modify code demo

Signed-off-by: Nc00382521 <chenyouan@huawei.com>
Change-Id: I3f6740606f736fddce35eb407832378a0e86466a
上级 1ace1120
...@@ -116,8 +116,8 @@ on(evt: 'progress', callback: (pg: SyncProgress) => void): void ...@@ -116,8 +116,8 @@ on(evt: 'progress', callback: (pg: SyncProgress) => void): void
```js ```js
let gallerySync = new cloudSync.GallerySync(); let gallerySync = new cloudSync.GallerySync();
gallerySync.on('progress', (pg: SyncProgress) => { gallerySync.on('progress', (pg: cloudSync.SyncProgress) => {
console.info("syncState:" + pg.syncState); console.info("syncState:" + pg.state);
}); });
``` ```
...@@ -153,8 +153,8 @@ off(evt: 'progress'): void ...@@ -153,8 +153,8 @@ off(evt: 'progress'): void
```js ```js
let gallerySync = new cloudSync.GallerySync(); let gallerySync = new cloudSync.GallerySync();
gallerySync.on('progress', (pg: SyncProgress) => { gallerySync.on('progress', (pg: cloudSync.SyncProgress) => {
console.info("syncState:" + pg.syncState); console.info("syncState:" + pg.state);
}); });
gallerySync.off('progress'); gallerySync.off('progress');
...@@ -194,8 +194,8 @@ start(): Promise&lt;void&gt; ...@@ -194,8 +194,8 @@ start(): Promise&lt;void&gt;
```js ```js
let gallerySync = new cloudSync.GallerySync(); let gallerySync = new cloudSync.GallerySync();
gallerySync.on('progress', (pg: SyncProgress) => { gallerySync.on('progress', (pg: cloudSync.SyncProgress) => {
console.info("syncState:" + pg.syncState); console.info("syncState:" + pg.state);
}); });
gallerySync.start().then(function() { gallerySync.start().then(function() {
...@@ -411,7 +411,7 @@ on(evt: 'progress', callback: (pg: DownloadProgress) => void): void ...@@ -411,7 +411,7 @@ on(evt: 'progress', callback: (pg: DownloadProgress) => void): void
```js ```js
let download = new cloudSync.Download(); let download = new cloudSync.Download();
download.on('progress', (pg: DownloadProgress) => { download.on('progress', (pg: cloudSync.DownloadProgress) => {
console.info("download state:" + pg.state); console.info("download state:" + pg.state);
}); });
``` ```
...@@ -448,7 +448,7 @@ off(evt: 'progress'): void ...@@ -448,7 +448,7 @@ off(evt: 'progress'): void
```js ```js
let download = new cloudSync.Download(); let download = new cloudSync.Download();
download.on('progress', (pg: DownloadProgress) => { download.on('progress', (pg: cloudSync.DownloadProgress) => {
console.info("download state:" + pg.state); console.info("download state:" + pg.state);
}); });
...@@ -481,12 +481,13 @@ start(uri: string): Promise&lt;void&gt; ...@@ -481,12 +481,13 @@ start(uri: string): Promise&lt;void&gt;
```js ```js
let download = new cloudSync.Download(); let download = new cloudSync.Download();
let uri: string = "file:///media/Photo/1";
download.on('progress', (pg: DownloadProgress) => { download.on('progress', (pg: cloudSync.DownloadProgress) => {
console.info("download state:" + pg.state); console.info("download state:" + pg.state);
}); });
download.start().then(function() { download.start(uri).then(function() {
console.info("start download successfully"); console.info("start download successfully");
}).catch(function(err) { }).catch(function(err) {
console.info("start download failed with error message: " + err.message + ", error code: " + err.code); console.info("start download failed with error message: " + err.message + ", error code: " + err.code);
...@@ -538,8 +539,9 @@ start(uri: string, callback: AsyncCallback&lt;void&gt;): void ...@@ -538,8 +539,9 @@ start(uri: string, callback: AsyncCallback&lt;void&gt;): void
```js ```js
let download = new cloudSync.Download(); let download = new cloudSync.Download();
let uri: string = "file:///media/Photo/1";
download.start((err) => { download.start(uri, (err) => {
if (err) { if (err) {
console.info("start download failed with error message: " + err.message + ", error code: " + err.code); console.info("start download failed with error message: " + err.message + ", error code: " + err.code);
} else { } else {
...@@ -588,8 +590,9 @@ stop(uri: string): Promise&lt;void&gt; ...@@ -588,8 +590,9 @@ stop(uri: string): Promise&lt;void&gt;
```js ```js
let download = new cloudSync.Download(); let download = new cloudSync.Download();
let uri: string = "file:///media/Photo/1";
download.stop().then(function() { download.stop(uri).then(function() {
console.info("stop download successfully"); console.info("stop download successfully");
}).catch(function(err) { }).catch(function(err) {
console.info("stop download failed with error message: " + err.message + ", error code: " + err.code); console.info("stop download failed with error message: " + err.message + ", error code: " + err.code);
...@@ -631,8 +634,9 @@ stop(uri: string, callback: AsyncCallback&lt;void&gt;): void ...@@ -631,8 +634,9 @@ stop(uri: string, callback: AsyncCallback&lt;void&gt;): void
```js ```js
let download = new cloudSync.Download(); let download = new cloudSync.Download();
let uri: string = "file:///media/Photo/1";
download.stop((err) => { download.stop(uri, (err) => {
if (err) { if (err) {
console.info("stop download failed with error message: " + err.message + ", error code: " + err.code); console.info("stop download failed with error message: " + err.message + ", error code: " + err.code);
} else { } else {
......
...@@ -414,7 +414,7 @@ clean(accountId: string, appActions: { [bundleName: string]: Action }): Promise& ...@@ -414,7 +414,7 @@ clean(accountId: string, appActions: { [bundleName: string]: Action }): Promise&
clean(accountId: string, appActions: { [bundleName: string]: Action }, callback: AsyncCallback&lt;void&gt;): void clean(accountId: string, appActions: { [bundleName: string]: Action }, callback: AsyncCallback&lt;void&gt;): void
异步方法去使能端云协同能力,以callback形式返回结果。 异步方法清理本地云相关数据,以callback形式返回结果。
**需要权限**:ohos.permission.CLOUDFILE_SYNC_MANAGER **需要权限**:ohos.permission.CLOUDFILE_SYNC_MANAGER
...@@ -426,7 +426,7 @@ clean(accountId: string, appActions: { [bundleName: string]: Action }, callback: ...@@ -426,7 +426,7 @@ clean(accountId: string, appActions: { [bundleName: string]: Action }, callback:
| ---------- | ------ | ---- | ---- | | ---------- | ------ | ---- | ---- |
| accountId | string | 是 | 帐号Id| | accountId | string | 是 | 帐号Id|
| appActions | object | 是 | 清理动作类型,bundleName为待清理应用包名, [Action](#action)为清理动作类型| | appActions | object | 是 | 清理动作类型,bundleName为待清理应用包名, [Action](#action)为清理动作类型|
| callback | AsyncCallback&lt;void&gt; | 是 | 异步去使能端云协同能力之后的回调 | | callback | AsyncCallback&lt;void&gt; | 是 | 异步方法清理本地云相关数据 |
**错误码:** **错误码:**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册