未验证 提交 aee9eccb 编写于 作者: O openharmony_ci 提交者: Gitee

!20468 修复示例代码问题

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