提交 a7235d18 编写于 作者: Z zhaolinglan

fix for VOD

Signed-off-by: Nzhaolinglan <zhaolinglan@huawei.com>
上级 62ace83a
...@@ -47,8 +47,8 @@ startAbility(want: Want, callback: AsyncCallback&lt;void&gt;): void; ...@@ -47,8 +47,8 @@ startAbility(want: Want, callback: AsyncCallback&lt;void&gt;): void;
```js ```js
let want = { let want = {
"bundleName": "com.example.myapp", 'bundleName': 'com.example.myapp',
"abilityName": "MyAbility"}; 'abilityName': 'MyAbility'};
this.context.startAbility(want, (err) => { this.context.startAbility(want, (err) => {
console.log('startAbility result:' + JSON.stringify(err)); console.log('startAbility result:' + JSON.stringify(err));
}); });
...@@ -79,8 +79,8 @@ startAbility(want: Want, options?: StartOptions): Promise\<void>; ...@@ -79,8 +79,8 @@ startAbility(want: Want, options?: StartOptions): Promise\<void>;
```js ```js
let want = { let want = {
"bundleName": "com.example.myapp", 'bundleName': 'com.example.myapp',
"abilityName": "MyAbility" 'abilityName': 'MyAbility'
}; };
this.context.startAbility(want).then((data) => { this.context.startAbility(want).then((data) => {
console.log('success:' + JSON.stringify(data)); console.log('success:' + JSON.stringify(data));
...@@ -110,15 +110,15 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback&lt;void& ...@@ -110,15 +110,15 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback&lt;void&
```js ```js
var want = { var want = {
"deviceId": "", 'deviceId': '',
"bundleName": "com.extreme.test", 'bundleName': 'com.extreme.test',
"abilityName": "MainAbility" 'abilityName': 'MainAbility'
}; };
var options = { var options = {
windowMode: 0, windowMode: 0,
}; };
this.context.startAbility(want, options, (error) => { this.context.startAbility(want, options, (error) => {
console.log("error.code = " + error.code) console.log('error.code = ' + error.code)
}) })
``` ```
......
...@@ -94,15 +94,15 @@ switchInputMethod(target: InputMethodProperty, callback: AsyncCallback&lt;boolea ...@@ -94,15 +94,15 @@ switchInputMethod(target: InputMethodProperty, callback: AsyncCallback&lt;boolea
**示例:** **示例:**
```js ```js
inputMethod.switchInputMethod({packageName:"com.example.kikakeyboard", methodId:"com.example.kikakeyboard"} ,(err,result) => { inputMethod.switchInputMethod({packageName:'com.example.kikakeyboard', methodId:'com.example.kikakeyboard'} ,(err,result) => {
if (err) { if (err) {
console.error("switchInputMethod err: " + JSON.stringify(err)); console.error('switchInputMethod err: ' + JSON.stringify(err));
return; return;
} }
if (result) { if (result) {
console.info("Success to switchInputMethod.(callback)"); console.info('Success to switchInputMethod.(callback)');
} else { } else {
console.error("Failed to switchInputMethod.(callback)"); console.error('Failed to switchInputMethod.(callback)');
} }
}); });
``` ```
...@@ -129,14 +129,14 @@ switchInputMethod(target: InputMethodProperty): Promise&lt;boolean&gt; ...@@ -129,14 +129,14 @@ switchInputMethod(target: InputMethodProperty): Promise&lt;boolean&gt;
```js ```js
inputMethod.switchInputMethod({packageName:"com.example.kikakeyboard", methodId:"com.example.kikakeyboard"}).then((result) => { inputMethod.switchInputMethod({packageName:'com.example.kikakeyboard', methodId:'com.example.kikakeyboard'}).then((result) => {
if (result) { if (result) {
console.info("Success to switchInputMethod.(promise)"); console.info('Success to switchInputMethod.(promise)');
} else { } else {
console.error("Failed to switchInputMethod.(promise)"); console.error('Failed to switchInputMethod.(promise)');
} }
}).catch((err) => { }).catch((err) => {
console.error("switchInputMethod promise err: " + err); console.error('switchInputMethod promise err: ' + err);
}) })
``` ```
## inputMethod.getCurrentInputMethod<sup>9+</sup> ## inputMethod.getCurrentInputMethod<sup>9+</sup>
...@@ -183,13 +183,13 @@ stopInput(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -183,13 +183,13 @@ stopInput(callback: AsyncCallback&lt;boolean&gt;): void
```js ```js
InputMethodController.stopInput((error, result) => { InputMethodController.stopInput((error, result) => {
if (error) { if (error) {
console.error("failed to stopInput because: " + JSON.stringify(error)); console.error('failed to stopInput because: ' + JSON.stringify(error));
return; return;
} }
if (result) { if (result) {
console.info("Success to stopInput.(callback)"); console.info('Success to stopInput.(callback)');
} else { } else {
console.error("Failed to stopInput.(callback)"); console.error('Failed to stopInput.(callback)');
} }
}); });
``` ```
...@@ -214,12 +214,12 @@ stopInput(): Promise&lt;boolean&gt; ...@@ -214,12 +214,12 @@ stopInput(): Promise&lt;boolean&gt;
```js ```js
InputMethodController.stopInput().then((result) => { InputMethodController.stopInput().then((result) => {
if (result) { if (result) {
console.info("Success to stopInput.(promise)"); console.info('Success to stopInput.(promise)');
} else { } else {
console.error("Failed to stopInput.(promise)"); console.error('Failed to stopInput.(promise)');
} }
}).catch((err) => { }).catch((err) => {
console.error("stopInput promise err: " + err); console.error('stopInput promise err: ' + err);
}) })
``` ```
...@@ -241,7 +241,7 @@ showSoftKeyboard(callback: AsyncCallback&lt;void&gt;): void ...@@ -241,7 +241,7 @@ showSoftKeyboard(callback: AsyncCallback&lt;void&gt;): void
```js ```js
InputMethodController.showSoftKeyboard((err) => { InputMethodController.showSoftKeyboard((err) => {
if (err == undefined) { if (err === undefined) {
console.info('showSoftKeyboard success'); console.info('showSoftKeyboard success');
} else { } else {
console.error('showSoftKeyboard failed because : ' + JSON.stringify(err)); console.error('showSoftKeyboard failed because : ' + JSON.stringify(err));
...@@ -292,7 +292,7 @@ hideSoftKeyboard(callback: AsyncCallback&lt;void&gt;): void ...@@ -292,7 +292,7 @@ hideSoftKeyboard(callback: AsyncCallback&lt;void&gt;): void
```js ```js
InputMethodController.hideSoftKeyboard((err) => { InputMethodController.hideSoftKeyboard((err) => {
if (err == undefined) { if (err === undefined) {
console.info('hideSoftKeyboard success'); console.info('hideSoftKeyboard success');
} else { } else {
console.error('hideSoftKeyboard failed because : ' + JSON.stringify(err)); console.error('hideSoftKeyboard failed because : ' + JSON.stringify(err));
...@@ -350,10 +350,10 @@ listInputMethod(enable: boolean, callback: AsyncCallback&lt;Array&lt;InputMethod ...@@ -350,10 +350,10 @@ listInputMethod(enable: boolean, callback: AsyncCallback&lt;Array&lt;InputMethod
imeList: Array<inputMethod.InputMethodProperty> = null imeList: Array<inputMethod.InputMethodProperty> = null
InputMethodSetting.listInputMethod(true, (err,data) => { InputMethodSetting.listInputMethod(true, (err,data) => {
if (err) { if (err) {
console.error("listInputMethod failed because: " + JSON.stringify(err)); console.error('listInputMethod failed because: ' + JSON.stringify(err));
return; return;
} }
console.log("listInputMethod success"); console.log('listInputMethod success');
this.imeList = data; this.imeList = data;
}); });
``` ```
...@@ -383,10 +383,10 @@ listInputMethod(enable: boolean): Promise&lt;Array&lt;InputMethodProperty&gt;&gt ...@@ -383,10 +383,10 @@ listInputMethod(enable: boolean): Promise&lt;Array&lt;InputMethodProperty&gt;&gt
```js ```js
imeList: Array<inputMethod.InputMethodProperty> = null imeList: Array<inputMethod.InputMethodProperty> = null
InputMethodSetting.listInputMethod(true).then((data) => { InputMethodSetting.listInputMethod(true).then((data) => {
console.info("listInputMethod success"); console.info('listInputMethod success');
this.imeList = data; this.imeList = data;
}).catch((err) => { }).catch((err) => {
console.error("listInputMethod promise err: " + err); console.error('listInputMethod promise err: ' + err);
}) })
``` ```
...@@ -410,10 +410,10 @@ listInputMethod(callback: AsyncCallback&lt;Array&lt;InputMethodProperty&gt;&gt;) ...@@ -410,10 +410,10 @@ listInputMethod(callback: AsyncCallback&lt;Array&lt;InputMethodProperty&gt;&gt;)
imeList: Array<inputMethod.InputMethodProperty> = null imeList: Array<inputMethod.InputMethodProperty> = null
InputMethodSetting.listInputMethod((err,data) => { InputMethodSetting.listInputMethod((err,data) => {
if (err) { if (err) {
console.error("listInputMethod failed because: " + JSON.stringify(err)); console.error('listInputMethod failed because: ' + JSON.stringify(err));
return; return;
} }
console.log("listInputMethod success"); console.log('listInputMethod success');
this.imeList = data; this.imeList = data;
}); });
``` ```
...@@ -437,10 +437,10 @@ listInputMethod(): Promise&lt;Array&lt;InputMethodProperty&gt;&gt; ...@@ -437,10 +437,10 @@ listInputMethod(): Promise&lt;Array&lt;InputMethodProperty&gt;&gt;
```js ```js
imeList: Array<inputMethod.InputMethodProperty> = null imeList: Array<inputMethod.InputMethodProperty> = null
InputMethodSetting.listInputMethod().then((data) => { InputMethodSetting.listInputMethod().then((data) => {
console.info("listInputMethod success"); console.info('listInputMethod success');
this.imeList = data; this.imeList = data;
}).catch((err) => { }).catch((err) => {
console.error("listInputMethod promise err: " + err); console.error('listInputMethod promise err: ' + err);
}) })
``` ```
...@@ -463,10 +463,10 @@ displayOptionalInputMethod(callback: AsyncCallback&lt;void&gt;): void ...@@ -463,10 +463,10 @@ displayOptionalInputMethod(callback: AsyncCallback&lt;void&gt;): void
```js ```js
InputMethodSetting.displayOptionalInputMethod((err) => { InputMethodSetting.displayOptionalInputMethod((err) => {
if (err) { if (err) {
console.error("displayOptionalInputMethod failed because: " + JSON.stringify(err)); console.error('displayOptionalInputMethod failed because: ' + JSON.stringify(err));
return; return;
} }
console.info("displayOptionalInputMethod success"); console.info('displayOptionalInputMethod success');
}); });
``` ```
...@@ -488,8 +488,8 @@ InputMethodSetting.displayOptionalInputMethod((err) => { ...@@ -488,8 +488,8 @@ InputMethodSetting.displayOptionalInputMethod((err) => {
```js ```js
InputMethodSetting.displayOptionalInputMethod().then(() => { InputMethodSetting.displayOptionalInputMethod().then(() => {
console.info("displayOptionalInputMethod success.(promise)"); console.info('displayOptionalInputMethod success.(promise)');
}).catch((err) => { }).catch((err) => {
console.error("displayOptionalInputMethod promise err: " + err); console.error('displayOptionalInputMethod promise err: ' + err);
}) })
``` ```
\ No newline at end of file
...@@ -140,7 +140,7 @@ off(type: 'inputStart', callback?: (kbController: KeyboardController, textInputC ...@@ -140,7 +140,7 @@ off(type: 'inputStart', callback?: (kbController: KeyboardController, textInputC
```js ```js
InputMethodEngine.off('inputStart', (kbController, textInputClient) => { InputMethodEngine.off('inputStart', (kbController, textInputClient) => {
console.log("delete inputStart notification."); console.log('delete inputStart notification.');
}); });
``` ```
...@@ -163,7 +163,7 @@ on(type: 'inputStop', callback: () => void): void ...@@ -163,7 +163,7 @@ on(type: 'inputStop', callback: () => void): void
```js ```js
InputMethodEngine.getInputMethodEngine().on('inputStop', () => { InputMethodEngine.getInputMethodEngine().on('inputStop', () => {
console.log("inputMethodEngine inputStop"); console.log('inputMethodEngine inputStop');
}); });
``` ```
...@@ -186,7 +186,7 @@ off(type: 'inputStop', callback: () => void): void ...@@ -186,7 +186,7 @@ off(type: 'inputStop', callback: () => void): void
```js ```js
InputMethodEngine.getInputMethodEngine().off('inputStop', () => { InputMethodEngine.getInputMethodEngine().off('inputStop', () => {
console.log("inputMethodEngine delete inputStop notification."); console.log('inputMethodEngine delete inputStop notification.');
}); });
``` ```
...@@ -209,7 +209,7 @@ on(type: 'setCallingWindow', callback: (wid:number) => void): void ...@@ -209,7 +209,7 @@ on(type: 'setCallingWindow', callback: (wid:number) => void): void
```js ```js
InputMethodEngine.getInputMethodEngine().on('setCallingWindow', (wid) => { InputMethodEngine.getInputMethodEngine().on('setCallingWindow', (wid) => {
console.log("inputMethodEngine setCallingWindow"); console.log('inputMethodEngine setCallingWindow');
}); });
``` ```
...@@ -232,7 +232,7 @@ off(type: 'setCallingWindow', callback: (wid:number) => void): void ...@@ -232,7 +232,7 @@ off(type: 'setCallingWindow', callback: (wid:number) => void): void
```js ```js
InputMethodEngine.getInputMethodEngine().off('setCallingWindow', () => { InputMethodEngine.getInputMethodEngine().off('setCallingWindow', () => {
console.log("inputMethodEngine delete setCallingWindow notification."); console.log('inputMethodEngine delete setCallingWindow notification.');
}); });
``` ```
...@@ -255,10 +255,10 @@ on(type: 'keyboardShow'|'keyboardHide', callback: () => void): void ...@@ -255,10 +255,10 @@ on(type: 'keyboardShow'|'keyboardHide', callback: () => void): void
```js ```js
InputMethodEngine.on('keyboardShow', () => { InputMethodEngine.on('keyboardShow', () => {
console.log("inputMethodEngine keyboardShow."); console.log('inputMethodEngine keyboardShow.');
}); });
InputMethodEngine.on('keyboardHide', () => { InputMethodEngine.on('keyboardHide', () => {
console.log("inputMethodEngine keyboardHide."); console.log('inputMethodEngine keyboardHide.');
}); });
``` ```
...@@ -281,10 +281,10 @@ off(type: 'keyboardShow'|'keyboardHide', callback?: () => void): void ...@@ -281,10 +281,10 @@ off(type: 'keyboardShow'|'keyboardHide', callback?: () => void): void
```js ```js
InputMethodEngine.off('keyboardShow', () => { InputMethodEngine.off('keyboardShow', () => {
console.log("inputMethodEngine delete keyboardShow notification."); console.log('inputMethodEngine delete keyboardShow notification.');
}); });
InputMethodEngine.off('keyboardHide', () => { InputMethodEngine.off('keyboardHide', () => {
console.log("inputMethodEngine delete keyboardHide notification."); console.log('inputMethodEngine delete keyboardHide notification.');
}); });
``` ```
...@@ -314,13 +314,13 @@ on(type: 'keyDown'|'keyUp', callback: (event: KeyEvent) => boolean): void ...@@ -314,13 +314,13 @@ on(type: 'keyDown'|'keyUp', callback: (event: KeyEvent) => boolean): void
```js ```js
KeyboardDelegate.on('keyUp', (keyEvent) => { KeyboardDelegate.on('keyUp', (keyEvent) => {
console.info("inputMethodEngine keyCode.(keyUp):" + JSON.stringify(keyEvent.keyCode)); console.info('inputMethodEngine keyCode.(keyUp):' + JSON.stringify(keyEvent.keyCode));
console.info("inputMethodEngine keyAction.(keyUp):" + JSON.stringify(keyEvent.keyAction)); console.info('inputMethodEngine keyAction.(keyUp):' + JSON.stringify(keyEvent.keyAction));
return true; return true;
}); });
KeyboardDelegate.on('keyDown', (keyEvent) => { KeyboardDelegate.on('keyDown', (keyEvent) => {
console.info("inputMethodEngine keyCode.(keyDown):" + JSON.stringify(keyEvent.keyCode)); console.info('inputMethodEngine keyCode.(keyDown):' + JSON.stringify(keyEvent.keyCode));
console.info("inputMethodEngine keyAction.(keyDown):" + JSON.stringify(keyEvent.keyAction)); console.info('inputMethodEngine keyAction.(keyDown):' + JSON.stringify(keyEvent.keyAction));
return true; return true;
}); });
``` ```
...@@ -344,11 +344,11 @@ off(type: 'keyDown'|'keyUp', callback?: (event: KeyEvent) => boolean): void ...@@ -344,11 +344,11 @@ off(type: 'keyDown'|'keyUp', callback?: (event: KeyEvent) => boolean): void
```js ```js
KeyboardDelegate.off('keyUp', (keyEvent) => { KeyboardDelegate.off('keyUp', (keyEvent) => {
console.log("delete keyUp notification."); console.log('delete keyUp notification.');
return true; return true;
}); });
KeyboardDelegate.off('keyDown', (keyEvent) => { KeyboardDelegate.off('keyDown', (keyEvent) => {
console.log("delete keyDown notification."); console.log('delete keyDown notification.');
return true; return true;
}); });
``` ```
...@@ -374,9 +374,9 @@ on(type: 'cursorContextChange', callback: (x: number, y:number, height:number) = ...@@ -374,9 +374,9 @@ on(type: 'cursorContextChange', callback: (x: number, y:number, height:number) =
```js ```js
KeyboardDelegate.on('cursorContextChange', (x, y, height) => { KeyboardDelegate.on('cursorContextChange', (x, y, height) => {
console.log("inputMethodEngine cursorContextChange x:" + x); console.log('inputMethodEngine cursorContextChange x:' + x);
console.log("inputMethodEngine cursorContextChange y:" + y); console.log('inputMethodEngine cursorContextChange y:' + y);
console.log("inputMethodEngine cursorContextChange height:" + height); console.log('inputMethodEngine cursorContextChange height:' + height);
}); });
``` ```
...@@ -400,7 +400,7 @@ off(type: 'cursorContextChange', callback?: (x: number, y:number, height:number) ...@@ -400,7 +400,7 @@ off(type: 'cursorContextChange', callback?: (x: number, y:number, height:number)
```js ```js
KeyboardDelegate.off('cursorContextChange', (x, y, height) => { KeyboardDelegate.off('cursorContextChange', (x, y, height) => {
console.log("delete cursorContextChange notification."); console.log('delete cursorContextChange notification.');
}); });
``` ```
### on('selectionChange') ### on('selectionChange')
...@@ -422,10 +422,10 @@ on(type: 'selectionChange', callback: (oldBegin: number, oldEnd: number, newBegi ...@@ -422,10 +422,10 @@ on(type: 'selectionChange', callback: (oldBegin: number, oldEnd: number, newBegi
```js ```js
KeyboardDelegate.on('selectionChange', (oldBegin, oldEnd, newBegin, newEnd) => { KeyboardDelegate.on('selectionChange', (oldBegin, oldEnd, newBegin, newEnd) => {
console.log("inputMethodEngine beforeEach selectionChange oldBegin:" + oldBegin); console.log('inputMethodEngine beforeEach selectionChange oldBegin:' + oldBegin);
console.log("inputMethodEngine beforeEach selectionChange oldEnd:" + oldEnd); console.log('inputMethodEngine beforeEach selectionChange oldEnd:' + oldEnd);
console.log("inputMethodEngine beforeEach selectionChange newBegin:" + newBegin); console.log('inputMethodEngine beforeEach selectionChange newBegin:' + newBegin);
console.log("inputMethodEngine beforeEach selectionChange newEnd:" + newEnd); console.log('inputMethodEngine beforeEach selectionChange newEnd:' + newEnd);
}); });
``` ```
...@@ -448,7 +448,7 @@ off(type: 'selectionChange', callback?: (oldBegin: number, oldEnd: number, newBe ...@@ -448,7 +448,7 @@ off(type: 'selectionChange', callback?: (oldBegin: number, oldEnd: number, newBe
```js ```js
KeyboardDelegate.off('selectionChange', (oldBegin, oldEnd, newBegin, newEnd) => { KeyboardDelegate.off('selectionChange', (oldBegin, oldEnd, newBegin, newEnd) => {
console.log("delete selectionChange notification."); console.log('delete selectionChange notification.');
}); });
``` ```
...@@ -472,7 +472,7 @@ on(type: 'textChange', callback: (text: string) => void): void ...@@ -472,7 +472,7 @@ on(type: 'textChange', callback: (text: string) => void): void
```js ```js
KeyboardDelegate.on('textChange', (text) => { KeyboardDelegate.on('textChange', (text) => {
console.log("inputMethodEngine textChange. text:" + text); console.log('inputMethodEngine textChange. text:' + text);
}); });
``` ```
...@@ -495,7 +495,7 @@ off(type: 'textChange', callback?: (text: string) => void): void ...@@ -495,7 +495,7 @@ off(type: 'textChange', callback?: (text: string) => void): void
```js ```js
keyboardDelegate.off('textChange', (text) => { keyboardDelegate.off('textChange', (text) => {
console.log("delete textChange notification. text:" + text); console.log('delete textChange notification. text:' + text);
}); });
``` ```
...@@ -522,11 +522,11 @@ hideKeyboard(callback: AsyncCallback&lt;void&gt;): void ...@@ -522,11 +522,11 @@ hideKeyboard(callback: AsyncCallback&lt;void&gt;): void
```js ```js
KeyboardController.hideKeyboard((err) => { KeyboardController.hideKeyboard((err) => {
if (err == undefined) { if (err === undefined) {
console.error("hideKeyboard callback result---err: " + err.msg); console.error('hideKeyboard callback result---err: ' + err.msg);
return; return;
} }
console.log("hideKeyboard callback."); console.log('hideKeyboard callback.');
}); });
``` ```
...@@ -549,9 +549,9 @@ hideKeyboard(): Promise&lt;void&gt; ...@@ -549,9 +549,9 @@ hideKeyboard(): Promise&lt;void&gt;
```js ```js
async function InputMethodEngine() { async function InputMethodEngine() {
await KeyboardController.hideKeyboard().then(() => { await KeyboardController.hideKeyboard().then(() => {
console.info("hideKeyboard promise."); console.info('hideKeyboard promise.');
}).catch((err) => { }).catch((err) => {
console.info("hideKeyboard promise err: " + err.msg); console.info('hideKeyboard promise err: ' + err.msg);
}); });
} }
``` ```
...@@ -580,11 +580,11 @@ getForward(length:number, callback: AsyncCallback&lt;string&gt;): void ...@@ -580,11 +580,11 @@ getForward(length:number, callback: AsyncCallback&lt;string&gt;): void
```js ```js
var length = 1; var length = 1;
TextInputClient.getForward(length, (err, text) => { TextInputClient.getForward(length, (err, text) => {
if (err == undefined) { if (err === undefined) {
console.error("getForward callback result---err: " + err.msg); console.error('getForward callback result---err: ' + err.msg);
return; return;
} }
console.log("getForward callback result---text: " + text); console.log('getForward callback result---text: ' + text);
}); });
``` ```
...@@ -614,9 +614,9 @@ getForward(length:number): Promise&lt;string&gt; ...@@ -614,9 +614,9 @@ getForward(length:number): Promise&lt;string&gt;
async function InputMethodEngine() { async function InputMethodEngine() {
var length = 1; var length = 1;
await TextInputClient.getForward(length).then((text) => { await TextInputClient.getForward(length).then((text) => {
console.info("getForward promise result---res: " + text); console.info('getForward promise result---res: ' + text);
}).catch((err) => { }).catch((err) => {
console.error("getForward promise err: " + err.msg); console.error('getForward promise err: ' + err.msg);
}); });
} }
``` ```
...@@ -641,11 +641,11 @@ getBackward(length:number, callback: AsyncCallback&lt;string&gt;): void ...@@ -641,11 +641,11 @@ getBackward(length:number, callback: AsyncCallback&lt;string&gt;): void
```js ```js
var length = 1; var length = 1;
TextInputClient.getBackward(length, (err, text) => { TextInputClient.getBackward(length, (err, text) => {
if (err == undefined) { if (err === undefined) {
console.error("getBackward callback result---err: " + err.msg); console.error('getBackward callback result---err: ' + err.msg);
return; return;
} }
console.log("getBackward callback result---text: " + text); console.log('getBackward callback result---text: ' + text);
}); });
``` ```
...@@ -675,9 +675,9 @@ getBackward(length:number): Promise&lt;string&gt; ...@@ -675,9 +675,9 @@ getBackward(length:number): Promise&lt;string&gt;
async function InputMethodEngine() { async function InputMethodEngine() {
var length = 1; var length = 1;
await TextInputClient.getBackward(length).then((text) => { await TextInputClient.getBackward(length).then((text) => {
console.info("getBackward promise result---res: " + text); console.info('getBackward promise result---res: ' + text);
}).catch((err) => { }).catch((err) => {
console.error("getBackward promise err: " + err.msg); console.error('getBackward promise err: ' + err.msg);
}); });
} }
``` ```
...@@ -702,14 +702,14 @@ deleteForward(length:number, callback: AsyncCallback&lt;boolean&gt;): void ...@@ -702,14 +702,14 @@ deleteForward(length:number, callback: AsyncCallback&lt;boolean&gt;): void
```js ```js
var length = 1; var length = 1;
TextInputClient.deleteForward(length, (err, result) => { TextInputClient.deleteForward(length, (err, result) => {
if (err == undefined) { if (err === undefined) {
console.error('deleteForward callback result---err: ' + err.msg); console.error('deleteForward callback result---err: ' + err.msg);
return; return;
} }
if (result) { if (result) {
console.info("Success to deleteForward.(callback) "); console.info('Success to deleteForward.(callback) ');
} else { } else {
console.error("Failed to deleteForward.(callback) "); console.error('Failed to deleteForward.(callback) ');
} }
}); });
``` ```
...@@ -740,12 +740,12 @@ async function InputMethodEngine() { ...@@ -740,12 +740,12 @@ async function InputMethodEngine() {
var length = 1; var length = 1;
await TextInputClient.deleteForward(length).then((result) => { await TextInputClient.deleteForward(length).then((result) => {
if (result) { if (result) {
console.info("Success to deleteForward.(promise) "); console.info('Success to deleteForward.(promise) ');
} else { } else {
console.error("Failed to deleteForward.(promise) "); console.error('Failed to deleteForward.(promise) ');
} }
}).catch((err) => { }).catch((err) => {
console.error("deleteForward promise err: " + err.msg); console.error('deleteForward promise err: ' + err.msg);
}); });
} }
``` ```
...@@ -770,14 +770,14 @@ deleteBackward(length:number, callback: AsyncCallback&lt;boolean&gt;): void ...@@ -770,14 +770,14 @@ deleteBackward(length:number, callback: AsyncCallback&lt;boolean&gt;): void
```js ```js
var length = 1; var length = 1;
TextInputClient.deleteBackward(length, (err, result) => { TextInputClient.deleteBackward(length, (err, result) => {
if (err == undefined) { if (err === undefined) {
console.error("deleteBackward callback result---err: " + err.msg); console.error('deleteBackward callback result---err: ' + err.msg);
return; return;
} }
if (result) { if (result) {
console.info("Success to deleteBackward.(callback) "); console.info('Success to deleteBackward.(callback) ');
} else { } else {
console.error("Failed to deleteBackward.(callback) "); console.error('Failed to deleteBackward.(callback) ');
} }
}); });
``` ```
...@@ -809,12 +809,12 @@ async function InputMethodEngine() { ...@@ -809,12 +809,12 @@ async function InputMethodEngine() {
var length = 1; var length = 1;
await TextInputClient.deleteBackward(length).then((result) => { await TextInputClient.deleteBackward(length).then((result) => {
if (result) { if (result) {
console.info("Success to deleteBackward.(promise) "); console.info('Success to deleteBackward.(promise) ');
} else { } else {
console.error("Failed to deleteBackward.(promise) "); console.error('Failed to deleteBackward.(promise) ');
} }
}).catch((err) => { }).catch((err) => {
console.error("deleteBackward promise err: " + err.msg); console.error('deleteBackward promise err: ' + err.msg);
}); });
} }
``` ```
...@@ -837,14 +837,14 @@ sendKeyFunction(action:number, callback: AsyncCallback&lt;boolean&gt;): void ...@@ -837,14 +837,14 @@ sendKeyFunction(action:number, callback: AsyncCallback&lt;boolean&gt;): void
```js ```js
TextInputClient.sendKeyFunction(keyFunction, (err, result) => { TextInputClient.sendKeyFunction(keyFunction, (err, result) => {
if (err == undefined) { if (err === undefined) {
console.error("sendKeyFunction callback result---err: " + err.msg); console.error('sendKeyFunction callback result---err: ' + err.msg);
return; return;
} }
if (result) { if (result) {
console.info("Success to sendKeyFunction.(callback) "); console.info('Success to sendKeyFunction.(callback) ');
} else { } else {
console.error("Failed to sendKeyFunction.(callback) "); console.error('Failed to sendKeyFunction.(callback) ');
} }
}); });
``` ```
...@@ -875,12 +875,12 @@ sendKeyFunction(action:number): Promise&lt;boolean&gt; ...@@ -875,12 +875,12 @@ sendKeyFunction(action:number): Promise&lt;boolean&gt;
async function InputMethodEngine() { async function InputMethodEngine() {
await client.sendKeyFunction(keyFunction).then((result) => { await client.sendKeyFunction(keyFunction).then((result) => {
if (result) { if (result) {
console.info("Success to sendKeyFunction.(promise) "); console.info('Success to sendKeyFunction.(promise) ');
} else { } else {
console.error("Failed to sendKeyFunction.(promise) "); console.error('Failed to sendKeyFunction.(promise) ');
} }
}).catch((err) => { }).catch((err) => {
console.error("sendKeyFunction promise err:" + err.msg); console.error('sendKeyFunction promise err:' + err.msg);
}); });
} }
``` ```
...@@ -904,14 +904,14 @@ insertText(text:string, callback: AsyncCallback&lt;boolean&gt;): void ...@@ -904,14 +904,14 @@ insertText(text:string, callback: AsyncCallback&lt;boolean&gt;): void
```js ```js
TextInputClient.insertText('test', (err, result) => { TextInputClient.insertText('test', (err, result) => {
if (err == undefined) { if (err === undefined) {
console.error("insertText callback result---err: " + err.msg); console.error('insertText callback result---err: ' + err.msg);
return; return;
} }
if (result) { if (result) {
console.info("Success to insertText.(callback) "); console.info('Success to insertText.(callback) ');
} else { } else {
console.error("Failed to insertText.(callback) "); console.error('Failed to insertText.(callback) ');
} }
}); });
``` ```
...@@ -942,12 +942,12 @@ insertText(text:string): Promise&lt;boolean&gt; ...@@ -942,12 +942,12 @@ insertText(text:string): Promise&lt;boolean&gt;
async function InputMethodEngine() { async function InputMethodEngine() {
await TextInputClient.insertText('test').then((result) => { await TextInputClient.insertText('test').then((result) => {
if (result) { if (result) {
console.info("Success to insertText.(promise) "); console.info('Success to insertText.(promise) ');
} else { } else {
console.error("Failed to insertText.(promise) "); console.error('Failed to insertText.(promise) ');
} }
}).catch((err) => { }).catch((err) => {
console.error("insertText promise err: " + err.msg); console.error('insertText promise err: ' + err.msg);
}); });
} }
``` ```
...@@ -970,12 +970,12 @@ getEditorAttribute(callback: AsyncCallback&lt;EditorAttribute&gt;): void ...@@ -970,12 +970,12 @@ getEditorAttribute(callback: AsyncCallback&lt;EditorAttribute&gt;): void
```js ```js
TextInputClient.getEditorAttribute((err, editorAttribute) => { TextInputClient.getEditorAttribute((err, editorAttribute) => {
if (err == undefined) { if (err === undefined) {
console.error("getEditorAttribute callback result---err: " + err.msg); console.error('getEditorAttribute callback result---err: ' + err.msg);
return; return;
} }
console.log("editorAttribute.inputPattern(callback): " + JSON.stringify(editorAttribute.inputPattern)); console.log('editorAttribute.inputPattern(callback): ' + JSON.stringify(editorAttribute.inputPattern));
console.log("editorAttribute.enterKeyType(callback): " + JSON.stringify(editorAttribute.enterKeyType)); console.log('editorAttribute.enterKeyType(callback): ' + JSON.stringify(editorAttribute.enterKeyType));
}); });
``` ```
...@@ -998,10 +998,10 @@ getEditorAttribute(): Promise&lt;EditorAttribute&gt; ...@@ -998,10 +998,10 @@ getEditorAttribute(): Promise&lt;EditorAttribute&gt;
```js ```js
async function InputMethodEngine() { async function InputMethodEngine() {
await TextInputClient.getEditorAttribute().then((editorAttribute) => { await TextInputClient.getEditorAttribute().then((editorAttribute) => {
console.info("editorAttribute.inputPattern(promise): " + JSON.stringify(editorAttribute.inputPattern)); console.info('editorAttribute.inputPattern(promise): ' + JSON.stringify(editorAttribute.inputPattern));
console.info("editorAttribute.enterKeyType(promise): " + JSON.stringify(editorAttribute.enterKeyType)); console.info('editorAttribute.enterKeyType(promise): ' + JSON.stringify(editorAttribute.enterKeyType));
}).catch((err) => { }).catch((err) => {
console.error("getEditorAttribute promise err: " + err.msg); console.error('getEditorAttribute promise err: ' + err.msg);
}); });
} }
``` ```
...@@ -1025,8 +1025,8 @@ moveCursor(direction: number, callback: AsyncCallback&lt;void&gt;): void ...@@ -1025,8 +1025,8 @@ moveCursor(direction: number, callback: AsyncCallback&lt;void&gt;): void
```js ```js
TextInputClient.moveCursor(inputMethodEngine.CURSOR_xxx, (err) => { TextInputClient.moveCursor(inputMethodEngine.CURSOR_xxx, (err) => {
if (err == undefined) { if (err === undefined) {
console.error("moveCursor callback result---err: " + err.msg); console.error('moveCursor callback result---err: ' + err.msg);
return; return;
} }
}); });
...@@ -1059,7 +1059,7 @@ async function InputMethodEngine() { ...@@ -1059,7 +1059,7 @@ async function InputMethodEngine() {
await TextInputClient.moveCursor(inputMethodEngine.CURSOR_xxx).then(async (err) => { await TextInputClient.moveCursor(inputMethodEngine.CURSOR_xxx).then(async (err) => {
console.log('moveCursor success'); console.log('moveCursor success');
}).catch((err) => { }).catch((err) => {
console.error("moveCursor success err: " + err.msg); console.error('moveCursor success err: ' + err.msg);
}); });
} }
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册