mirror of
https://gitee.com/openharmony/third_party_jsframework
synced 2024-11-23 06:40:59 +00:00
!284 getKeyboardType interface
Merge pull request !284 from shaoziyun/master
This commit is contained in:
commit
b4d21ec940
31
runtime/main/extend/systemplugin/napi/ohos_multimodalInput_inputDevice.js
Normal file → Executable file
31
runtime/main/extend/systemplugin/napi/ohos_multimodalInput_inputDevice.js
Normal file → Executable file
@ -30,7 +30,8 @@ export function mockInputDevice() {
|
||||
}
|
||||
|
||||
const EventType = ['changed']
|
||||
const DeviceIds = [0, 1, 2, 3, 4, 5, 6, 7]
|
||||
const DeviceIds = [0, 1, 2, 3, 4]
|
||||
const GetKeyboardType = 3
|
||||
const inputDevice = {
|
||||
on: function (...args) {
|
||||
console.warn("inputDevice.on interface mocked in the Previewer. How this interface works on the" +
|
||||
@ -173,7 +174,31 @@ export function mockInputDevice() {
|
||||
}
|
||||
args[2].call(this, KeystrokeAbilityArr);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
getKeyboardType: function(...args) {
|
||||
console.warn("inputDevice.getKeyboardType interface mocked in the Previewer." +
|
||||
"How this interface works on the" + " Previewer may be different from that on a real device.");
|
||||
const len = args.length;
|
||||
if (len < 1 || len > 2) {
|
||||
console.warn("parameter number error");
|
||||
return;
|
||||
}
|
||||
if (typeof args[0] !== 'number') {
|
||||
console.warn("the first parameter error");
|
||||
return;
|
||||
}
|
||||
if (len == 1) {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(GetKeyboardType);
|
||||
})
|
||||
} else {
|
||||
if (typeof args[1] !== 'function') {
|
||||
console.warn("the second parameter type must be function");
|
||||
return;
|
||||
}
|
||||
args[1].call(this, GetKeyboardType);
|
||||
}
|
||||
},
|
||||
};
|
||||
return inputDevice
|
||||
}
|
Loading…
Reference in New Issue
Block a user