js: implement keyboard related api

This commit is contained in:
王劲鹏
2021-03-18 18:47:49 +08:00
committed by osborn
parent eba0261082
commit a21cdcd874
11 changed files with 206 additions and 1 deletions

View File

@@ -2643,6 +2643,18 @@ function notch(context) {
};
}
function keyboard(context) {
return {
subscribe: (callback) => {
return context.callNative('keyboard', 'subscribe', context.function2Id(callback));
},
unsubscribe: (subscribeId) => {
context.removeFuncById(subscribeId);
return context.callNative('keyboard', 'unsubscribe', subscribeId);
}
};
}
class Observable {
constructor(provider, clz) {
this.observers = new Set;
@@ -2789,6 +2801,7 @@ exports.hlayout = hlayout;
exports.image = image;
exports.input = input;
exports.internalScheme = internalScheme;
exports.keyboard = keyboard;
exports.layoutConfig = layoutConfig;
exports.list = list;
exports.listItem = listItem;