diff --git a/zh-cn/application-dev/reference/apis/js-apis-fileio.md b/zh-cn/application-dev/reference/apis/js-apis-fileio.md index 5091a8c8a7c372db9a5aed4a03fed5791ae886dd..67e6e514a81797d1fd85a7e6c840e99a6f2b4423 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-fileio.md +++ b/zh-cn/application-dev/reference/apis/js-apis-fileio.md @@ -2369,7 +2369,9 @@ createWatcher(filename: string, events: number, callback: AsyncCallback<numbe ```js let filename = path +"/test.txt"; fileio.createWatcher(filename, 1, function(number){ - // do something + console.info("Monitoring times: "+number); + }).then(function(watcher){ + console.info("listening for file changes"); }); ``` @@ -2561,11 +2563,12 @@ stop(): Promise<void> **示例:** ```js let filename = path +"/test.txt"; - let watcher = await fileio.createWatcher(filename, 1, function(number){ - // do something - }); - watcher.stop().then(function(){ - + fileio.createWatcher(filename, 1, function(number){ + console.info("Monitoring times: "+number); + }).then(function(watcher){ + watcher.stop().then(function(){ + console.info("close watcher succeed"); + }); }); ``` @@ -2586,11 +2589,12 @@ stop(callback: AsyncCallback<void>): void **示例:** ```js let filename = path +"/test.txt"; - let watcher = await fileio.createWatcher(filename, 1, function(number){ - // do something - }); - watcher.stop(function(){ - + fileio.createWatcher(filename, 1, function(number){ + console.info("Monitoring times: "+number); + }).then(function(watcher){ + watcher.stop(function(){ + console.info("close watcher succeed"); + }); }); ```