未验证 提交 a0c26749 编写于 作者: W wusongqing 提交者: Gitee

correct grammar errors in console.error and console.log

Signed-off-by: Nwusongqing <wusongqing@huawei.com>
上级 14a72706
...@@ -42,10 +42,10 @@ getAllScreens(callback: AsyncCallback&lt;Array&lt;Screen&gt;&gt;): void ...@@ -42,10 +42,10 @@ getAllScreens(callback: AsyncCallback&lt;Array&lt;Screen&gt;&gt;): void
let screenClass = null; let screenClass = null;
screen.getAllScreens((err, data) => { screen.getAllScreens((err, data) => {
if (err.code) { if (err.code) {
console.error('Failed to get all screens . Cause: ' + JSON.stringify(err)); console.error('Failed to get all screens. Cause: ' + JSON.stringify(err));
return; return;
} }
console.info('Succeeded in getting all screens . Data:' + JSON.stringify(data)); console.info('Succeeded in getting all screens. Data:' + JSON.stringify(data));
screenClass = data[0]; screenClass = data[0];
}); });
``` ```
...@@ -79,9 +79,9 @@ let screenClass = null; ...@@ -79,9 +79,9 @@ let screenClass = null;
let promise = screen.getAllScreens(); let promise = screen.getAllScreens();
promise.then((data) => { promise.then((data) => {
screenClass = data[0]; screenClass = data[0];
console.log('Succeeded in getting all screens . Data:'+ JSON.stringify(data)); console.log('Succeeded in getting all screens. Data:'+ JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
console.log('Failed to get all screens . Cause: ' + JSON.stringify(err)); console.log('Failed to get all screens. Cause: ' + JSON.stringify(err));
}); });
``` ```
...@@ -105,7 +105,7 @@ on(eventType: 'connect' | 'disconnect' | 'change', callback: Callback&lt;number& ...@@ -105,7 +105,7 @@ on(eventType: 'connect' | 'disconnect' | 'change', callback: Callback&lt;number&
```js ```js
try { try {
let callback = (data) => { let callback = (data) => {
console.info('Register the callback for screen changes. Data: ' + JSON.stringify(data)) console.info('Succeeded in registering the callback for screen changes. Data: ' + JSON.stringify(data))
}; };
screen.on('connect', callback); screen.on('connect', callback);
} catch (exception) { } catch (exception) {
...@@ -133,7 +133,7 @@ off(eventType: 'connect' | 'disconnect' | 'change', callback?: Callback&lt;numbe ...@@ -133,7 +133,7 @@ off(eventType: 'connect' | 'disconnect' | 'change', callback?: Callback&lt;numbe
```js ```js
try { try {
let callback = (data) => { let callback = (data) => {
console.info('Unregister the callback for screen changes. Data: ' + JSON.stringify(data)) console.info('Succeeded in unregistering the callback for screen changes. Data: ' + JSON.stringify(data))
}; };
screen.off('connect', callback); screen.off('connect', callback);
} catch (exception) { } catch (exception) {
...@@ -171,14 +171,14 @@ try { ...@@ -171,14 +171,14 @@ try {
let groupId = null; let groupId = null;
screen.makeExpand([{screenId: 0, startX: 0, startY: 0}, {screenId: 1, startX: 1080, startY: 0}], (err, data) => { screen.makeExpand([{screenId: 0, startX: 0, startY: 0}, {screenId: 1, startX: 1080, startY: 0}], (err, data) => {
if (err.code) { if (err.code) {
console.error('Failed to make screens as expand-screen. Code:' + JSON.stringify(err)); console.error('Failed to expand the screen. Code:' + JSON.stringify(err));
return; return;
} }
groupId = data; groupId = data;
console.info('Succeeded in making screens as expand-screen. Data: ' + JSON.stringify(data)); console.info('Succeeded in expanding the screen. Data: ' + JSON.stringify(data));
}); });
} catch (exception) { } catch (exception) {
console.error('Failed to make screens as expand-screen. Code: ' + JSON.stringify(exception)); console.error('Failed to expand the screen. Code: ' + JSON.stringify(exception));
}; };
``` ```
...@@ -215,12 +215,12 @@ makeExpand(options:Array&lt;ExpandOption&gt;): Promise&lt;number&gt; ...@@ -215,12 +215,12 @@ makeExpand(options:Array&lt;ExpandOption&gt;): Promise&lt;number&gt;
```js ```js
try { try {
screen.makeExpand([{screenId: 0, startX: 0, startY: 0}, {screenId: 1, startX: 1080, startY: 0}]).then((data) => { screen.makeExpand([{screenId: 0, startX: 0, startY: 0}, {screenId: 1, startX: 1080, startY: 0}]).then((data) => {
console.info('Succeeded in making screens as expand-screen. Data: ' + JSON.stringify(data)); console.info('Succeeded in expanding the screen. Data: ' + JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
console.error('Failed to make screens as expand-screen. Code:' + JSON.stringify(err)); console.error('Failed to expand the screen. Code:' + JSON.stringify(err));
}); });
} catch (exception) { } catch (exception) {
console.error('Failed to make screens as expand-screen. Code: ' + JSON.stringify(exception)); console.error('Failed to expand the screen. Code: ' + JSON.stringify(exception));
}; };
``` ```
...@@ -256,13 +256,13 @@ let mirrorScreenIds = [1, 2, 3]; ...@@ -256,13 +256,13 @@ let mirrorScreenIds = [1, 2, 3];
try { try {
screen.makeMirror(mainScreenId, mirrorScreenIds, (err, data) => { screen.makeMirror(mainScreenId, mirrorScreenIds, (err, data) => {
if (err.code) { if (err.code) {
console.error('Failed to make screens as mirror-screen. Code: ' + JSON.stringify(err)); console.error('Failed to set screen mirroring. Code: ' + JSON.stringify(err));
return; return;
} }
console.info('Succeeded in making screens as mirror-screen. Data: ' + JSON.stringify(data)); console.info('Succeeded in setting screen mirroring. Data: ' + JSON.stringify(data));
}); });
} catch (exception) { } catch (exception) {
console.error('Failed to make screens as mirror-screen. Code: ' + JSON.stringify(exception)); console.error('Failed to set screen mirroring. Code: ' + JSON.stringify(exception));
}; };
``` ```
...@@ -302,12 +302,12 @@ let mainScreenId = 0; ...@@ -302,12 +302,12 @@ let mainScreenId = 0;
let mirrorScreenIds = [1, 2, 3]; let mirrorScreenIds = [1, 2, 3];
try { try {
screen.makeMirror(mainScreenId, mirrorScreenIds).then((data) => { screen.makeMirror(mainScreenId, mirrorScreenIds).then((data) => {
console.info('Succeeded in making screens as mirror-screen. Data: ' + JSON.stringify(data)); console.info('Succeeded in setting screen mirroring. Data: ' + JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
console.error('Failed to make screens as mirror-screen. Code: ' + JSON.stringify(err)); console.error('Failed to set screen mirroring. Code: ' + JSON.stringify(err));
}); });
} catch (exception) { } catch (exception) {
console.error('Failed to make screens as mirror-screen. Code: ' + JSON.stringify(exception)); console.error('Failed to set screen mirroring. Code: ' + JSON.stringify(exception));
}; };
``` ```
...@@ -349,14 +349,14 @@ try { ...@@ -349,14 +349,14 @@ try {
surfaceId: '' surfaceId: ''
}, (err, data) => { }, (err, data) => {
if (err.code) { if (err.code) {
console.error('Failed to create virtual screen. Code: ' + JSON.stringify(err)); console.error('Failed to create the virtual screen. Code: ' + JSON.stringify(err));
return; return;
} }
screenClass = data; screenClass = data;
console.info('Succeeded in creating virtual screen. Data: ' + JSON.stringify(data)); console.info('Succeeded in creating the virtual screen. Data: ' + JSON.stringify(data));
}); });
} catch (exception) { } catch (exception) {
console.error('Failed to create virtual screen. Code: ' + JSON.stringify(exception)); console.error('Failed to create the virtual screen. Code: ' + JSON.stringify(exception));
}; };
``` ```
...@@ -403,12 +403,12 @@ try { ...@@ -403,12 +403,12 @@ try {
surfaceId: '' surfaceId: ''
}).then((data) => { }).then((data) => {
screenClass = data; screenClass = data;
console.info('Succeeded in creating virtual screen. Data: ' + JSON.stringify(data)); console.info('Succeeded in creating the virtual screen. Data: ' + JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
console.error('Failed to create virtual screen. Code: ' + JSON.stringify(err)); console.error('Failed to create the virtual screen. Code: ' + JSON.stringify(err));
}); });
} catch (exception) { } catch (exception) {
console.error('Failed to create virtual screen. Code: ' + JSON.stringify(exception)); console.error('Failed to create the virtual screen. Code: ' + JSON.stringify(exception));
}; };
``` ```
...@@ -442,13 +442,13 @@ let screenId = 1; ...@@ -442,13 +442,13 @@ let screenId = 1;
try { try {
screen.destroyVirtualScreen(screenId, (err,data) => { screen.destroyVirtualScreen(screenId, (err,data) => {
if (err.code) { if (err.code) {
console.error('Failed to destroy virtual screen. Code: ' + JSON.stringify(err)); console.error('Failed to destroy the virtual screen. Code: ' + JSON.stringify(err));
return; return;
} }
console.info('Succeeded in destroying virtual screen.'); console.info('Succeeded in destroying the virtual screen.');
}); });
} catch (exception) { } catch (exception) {
console.error('Failed to destroy virtual screen. Code: ' + JSON.stringify(exception)); console.error('Failed to destroy the virtual screen. Code: ' + JSON.stringify(exception));
}; };
``` ```
...@@ -486,12 +486,12 @@ destroyVirtualScreen(screenId:number): Promise&lt;void&gt; ...@@ -486,12 +486,12 @@ destroyVirtualScreen(screenId:number): Promise&lt;void&gt;
let screenId = 1; let screenId = 1;
try { try {
screen.destroyVirtualScreen(screenId).then((data) => { screen.destroyVirtualScreen(screenId).then((data) => {
console.info('Succeeded in destroying virtual screen.'); console.info('Succeeded in destroying the virtual screen.');
}).catch((err) => { }).catch((err) => {
console.error('Failed to destroy virtual screen. Code: ' + JSON.stringify(err)); console.error('Failed to destroy the virtual screen. Code: ' + JSON.stringify(err));
}); });
} catch (exception) { } catch (exception) {
console.error('Failed to destroy virtual screen. Code: ' + JSON.stringify(exception)); console.error('Failed to destroy the virtual screen. Code: ' + JSON.stringify(exception));
}; };
``` ```
...@@ -529,13 +529,13 @@ let surfaceId = '2048'; ...@@ -529,13 +529,13 @@ let surfaceId = '2048';
try { try {
screen.setVirtualScreenSurface(screenId, surfaceId, (err,data) => { screen.setVirtualScreenSurface(screenId, surfaceId, (err,data) => {
if (err.code) { if (err.code) {
console.error('Failed to Set surface for the virtual screen. Code: ' + JSON.stringify(err)); console.error('Failed to set the surface for the virtual screen. Code: ' + JSON.stringify(err));
return; return;
} }
console.info('Succeeded in setting surface for the virtual screen.'); console.info('Succeeded in setting the surface for the virtual screen.');
}); });
} catch (exception) { } catch (exception) {
console.error('Failed to Set surface for the virtual screen. Code: ' + JSON.stringify(exception)); console.error('Failed to set the surface for the virtual screen. Code: ' + JSON.stringify(exception));
}; };
``` ```
...@@ -577,12 +577,12 @@ let screenId = 1; ...@@ -577,12 +577,12 @@ let screenId = 1;
let surfaceId = '2048'; let surfaceId = '2048';
try { try {
screen.setVirtualScreenSurface(screenId, surfaceId).then((data) => { screen.setVirtualScreenSurface(screenId, surfaceId).then((data) => {
console.info('Succeeded in setting surface for the virtual screen.'); console.info('Succeeded in setting the surface for the virtual screen.');
}).catch((err) => { }).catch((err) => {
console.error('Failed to Set surface for the virtual screen. Code: ' + JSON.stringify(err)); console.error('Failed to set the surface for the virtual screen. Code: ' + JSON.stringify(err));
}); });
} catch (exception) { } catch (exception) {
console.error('Failed to Set surface for the virtual screen. Code: ' + JSON.stringify(exception)); console.error('Failed to set the surface for the virtual screen. Code: ' + JSON.stringify(exception));
}; };
``` ```
...@@ -604,9 +604,9 @@ isScreenRotationLocked(): Promise&lt;boolean&gt; ...@@ -604,9 +604,9 @@ isScreenRotationLocked(): Promise&lt;boolean&gt;
```js ```js
screen.isScreenRotationLocked().then((isLocked) => { screen.isScreenRotationLocked().then((isLocked) => {
console.info('Succeeded in getting screen rotation lock status. isLocked:'+ JSON.stringify(isLocked)); console.info('Succeeded in getting the screen rotation lock status. isLocked:'+ JSON.stringify(isLocked));
}).catch((err) => { }).catch((err) => {
console.error('Failed to get screen rotation lock status. Cause:' + JSON.stringify(err)); console.error('Failed to get the screen rotation lock status. Cause:' + JSON.stringify(err));
}); });
``` ```
...@@ -629,10 +629,10 @@ isScreenRotationLocked(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -629,10 +629,10 @@ isScreenRotationLocked(callback: AsyncCallback&lt;boolean&gt;): void
```js ```js
screen.isScreenRotationLocked((err, isLocked) => { screen.isScreenRotationLocked((err, isLocked) => {
if (err.code) { if (err.code) {
console.error('Failed to get screen rotation lock status. Cause:' + JSON.stringify(err)); console.error('Failed to get the screen rotation lock status. Cause:' + JSON.stringify(err));
return; return;
} }
console.info('Succeeded in getting screen rotation lock status. isLocked:' + JSON.stringify(isLocked)); console.info('Succeeded in getting the screen rotation lock status. isLocked:' + JSON.stringify(isLocked));
}); });
``` ```
...@@ -662,12 +662,12 @@ setScreenRotationLocked(isLocked: boolean): Promise&lt;void&gt; ...@@ -662,12 +662,12 @@ setScreenRotationLocked(isLocked: boolean): Promise&lt;void&gt;
let isLocked = false; let isLocked = false;
try { try {
screen.setScreenRotationLocked(isLocked).then((data) => { screen.setScreenRotationLocked(isLocked).then((data) => {
console.info('Succeeded in setting whether to lock screen rotation'); console.info('Succeeded in unlocking auto rotate');
}).catch((err) => { }).catch((err) => {
console.error('Failed to set whether to lock screen rotation. Code: ' + JSON.stringify(err)); console.error('Failed to unlock auto rotate. Code: ' + JSON.stringify(err));
}); });
} catch (exception) { } catch (exception) {
console.error('Failed to set whether to lock screen rotation. Code: ' + JSON.stringify(exception)); console.error('Failed to unlock auto rotate. Code: ' + JSON.stringify(exception));
}; };
``` ```
...@@ -693,13 +693,13 @@ let isLocked = false; ...@@ -693,13 +693,13 @@ let isLocked = false;
try { try {
screen.setScreenRotationLocked(isLocked, (err, data) => { screen.setScreenRotationLocked(isLocked, (err, data) => {
if (err.code) { if (err.code) {
console.error('Failed to set whether to lock screen rotation. Cause:' + JSON.stringify(err)); console.error('Failed to unlock auto rotate. Cause:' + JSON.stringify(err));
return; return;
} }
console.info('Succeeded in setting whether to lock screen rotation.'); console.info('Succeeded in unlocking auto rotate.');
}); });
} catch (exception) { } catch (exception) {
console.error('Failed to set whether to lock screen rotation. Code: ' + JSON.stringify(exception)); console.error('Failed to unlock auto rotate. Code: ' + JSON.stringify(exception));
}; };
``` ```
...@@ -772,13 +772,13 @@ setOrientation(orientation: Orientation, callback: AsyncCallback&lt;void&gt;): v ...@@ -772,13 +772,13 @@ setOrientation(orientation: Orientation, callback: AsyncCallback&lt;void&gt;): v
try { try {
screenClass.setOrientation(screen.Orientation.VERTICAL, (err, data) => { screenClass.setOrientation(screen.Orientation.VERTICAL, (err, data) => {
if (err.code) { if (err.code) {
console.error('Failed to set Orientation VERTICAL. Code: ' + JSON.stringify(err)); console.error('Failed to set the vertical orientation. Code: ' + JSON.stringify(err));
return; return;
} }
console.info('Succeeded in setting Orientation VERTICAL. data: ' + JSON.stringify(data)); console.info('Succeeded in setting the vertical orientation. data: ' + JSON.stringify(data));
}); });
} catch (exception) { } catch (exception) {
console.error('Failed to set Orientation VERTICAL. Code: ' + JSON.stringify(exception)); console.error('Failed to set the vertical orientation. Code: ' + JSON.stringify(exception));
}; };
``` ```
...@@ -814,12 +814,12 @@ setOrientation(orientation: Orientation): Promise&lt;void&gt; ...@@ -814,12 +814,12 @@ setOrientation(orientation: Orientation): Promise&lt;void&gt;
try { try {
let promise = screenClass.setOrientation(screen.Orientation.VERTICAL); let promise = screenClass.setOrientation(screen.Orientation.VERTICAL);
promise.then((data) => { promise.then((data) => {
console.info('Succeeded in setting Orientation VERTICAL. Data: ' + JSON.stringify(data)); console.info('Succeeded in setting the vertical orientation. Data: ' + JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
console.error('Failed to set Orientation VERTICAL. Cause: ' + JSON.stringify(err)); console.error('Failed to set the vertical orientation. Cause: ' + JSON.stringify(err));
}); });
} catch (exception) { } catch (exception) {
console.error('Failed to set Orientation VERTICAL. Code: ' + JSON.stringify(exception)); console.error('Failed to set the vertical orientation. Code: ' + JSON.stringify(exception));
}; };
``` ```
...@@ -851,13 +851,13 @@ let modeIndex = 0; ...@@ -851,13 +851,13 @@ let modeIndex = 0;
try { try {
screenClass.setScreenActiveMode(modeIndex, (err, data) => { screenClass.setScreenActiveMode(modeIndex, (err, data) => {
if (err.code) { if (err.code) {
console.error('Failed to set ScreenActiveMode 0. Code: ' + JSON.stringify(err)); console.error('Failed to set screen active mode 0. Code: ' + JSON.stringify(err));
return; return;
} }
console.info('Succeeded in setting ScreenActiveMode 0. data: ' + JSON.stringify(data)); console.info('Succeeded in setting screen active mode 0. data: ' + JSON.stringify(data));
}); });
} catch (exception) { } catch (exception) {
console.error('Failed to set ScreenActiveMode 0. Code: ' + JSON.stringify(exception)); console.error('Failed to set screen active mode 0. Code: ' + JSON.stringify(exception));
}; };
``` ```
...@@ -894,12 +894,12 @@ let modeIndex = 0; ...@@ -894,12 +894,12 @@ let modeIndex = 0;
try { try {
let promise = screenClass.setScreenActiveMode(modeIndex); let promise = screenClass.setScreenActiveMode(modeIndex);
promise.then((data) => { promise.then((data) => {
console.info('Succeeded in setting ScreenActiveMode 0. Data: ' + JSON.stringify(data)); console.info('Succeeded in setting screen active mode 0. Data: ' + JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
console.error('Failed to set ScreenActiveMode 0. Code: ' + JSON.stringify(err)); console.error('Failed to set screen active mode 0. Code: ' + JSON.stringify(err));
}); });
} catch (exception) { } catch (exception) {
console.error('Failed to set ScreenActiveMode 0. Code: ' + JSON.stringify(exception)); console.error('Failed to set screen active mode 0. Code: ' + JSON.stringify(exception));
}; };
``` ```
...@@ -931,13 +931,13 @@ let densityDpi = 320; ...@@ -931,13 +931,13 @@ let densityDpi = 320;
try { try {
screenClass.setDensityDpi(densityDpi, (err, data) => { screenClass.setDensityDpi(densityDpi, (err, data) => {
if (err.code) { if (err.code) {
console.error('Failed to set DensityDpi 320. Code: ' + JSON.stringify(err)); console.error('Failed to set the pixel density of the screen to 320. Code: ' + JSON.stringify(err));
return; return;
} }
console.info('Succeed in setting DensityDpi 320. data: ' + JSON.stringify(data)); console.info('Succeed in setting the pixel density of the screen to 320. data: ' + JSON.stringify(data));
}); });
} catch (exception) { } catch (exception) {
console.error('Failed to set DensityDpi 320. Code: ' + JSON.stringify(exception)); console.error('Failed to set the pixel density of the screen to 320. Code: ' + JSON.stringify(exception));
}; };
``` ```
...@@ -974,12 +974,12 @@ let densityDpi = 320; ...@@ -974,12 +974,12 @@ let densityDpi = 320;
try { try {
let promise = screenClass.setDensityDpi(densityDpi); let promise = screenClass.setDensityDpi(densityDpi);
promise.then((data) => { promise.then((data) => {
console.info('Succeeded in setting DensityDpi 320. Data: ' + JSON.stringify(data)); console.info('Succeeded in setting the pixel density of the screen to 320. Data: ' + JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
console.error('Failed to set DensityDpi 320. Code: ' + JSON.stringify(err)); console.error('Failed to set the pixel density of the screen to 320. Code: ' + JSON.stringify(err));
}); });
} catch (exception) { } catch (exception) {
console.error('Failed to set DensityDpi 320. Code: ' + JSON.stringify(exception)); console.error('Failed to set the pixel density of the screen to 320. Code: ' + JSON.stringify(exception));
}; };
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册