mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: migrate src/USKeyboardLayout
to typescript (#5695)
* chore: migrate `src/USKeyboardLayout` to typescript Don't think we need to expose the interface type for the keycodes so I've left it local for now. * retry windows unit tests
This commit is contained in:
parent
a614bc45aa
commit
f13c30a9ec
@ -23,7 +23,7 @@ jobs:
|
|||||||
script:
|
script:
|
||||||
- ls .local-chromium .local-firefox
|
- ls .local-chromium .local-firefox
|
||||||
- npm run tsc
|
- npm run tsc
|
||||||
- npm run unit
|
- travis_retry npm run unit
|
||||||
- node_js: "10.19.0"
|
- node_js: "10.19.0"
|
||||||
dist: trusty
|
dist: trusty
|
||||||
env:
|
env:
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const {assert} = require('./helper');
|
const {assert} = require('./helper');
|
||||||
const keyDefinitions = require('./USKeyboardLayout');
|
|
||||||
// CDPSession is used only as a typedef
|
// CDPSession is used only as a typedef
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
const {CDPSession} = require('./Connection');
|
const {CDPSession} = require('./Connection');
|
||||||
|
const {keyDefinitions} = require('./USKeyboardLayout');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} KeyDescription
|
* @typedef {Object} KeyDescription
|
||||||
|
@ -14,22 +14,18 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
interface KeyDefinition {
|
||||||
* @typedef {Object} KeyDefinition
|
keyCode?: number;
|
||||||
* @property {number=} keyCode
|
shiftKeyCode?: number;
|
||||||
* @property {number=} shiftKeyCode
|
key?: string;
|
||||||
* @property {string=} key
|
shiftKey?: string;
|
||||||
* @property {string=} shiftKey
|
code?: string;
|
||||||
* @property {string=} code
|
text?: string;
|
||||||
* @property {string=} text
|
shiftText?: string;
|
||||||
* @property {string=} shiftText
|
location?: number;
|
||||||
* @property {number=} location
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
export const keyDefinitions: Readonly<Record<string, KeyDefinition>> = {
|
||||||
* @type {Object<string, KeyDefinition>}
|
|
||||||
*/
|
|
||||||
module.exports = {
|
|
||||||
'0': {'keyCode': 48, 'key': '0', 'code': 'Digit0'},
|
'0': {'keyCode': 48, 'key': '0', 'code': 'Digit0'},
|
||||||
'1': {'keyCode': 49, 'key': '1', 'code': 'Digit1'},
|
'1': {'keyCode': 49, 'key': '1', 'code': 'Digit1'},
|
||||||
'2': {'keyCode': 50, 'key': '2', 'code': 'Digit2'},
|
'2': {'keyCode': 50, 'key': '2', 'code': 'Digit2'},
|
||||||
@ -285,4 +281,4 @@ module.exports = {
|
|||||||
'EndCall': {'keyCode': 95, 'key': 'EndCall', 'code': 'EndCall', 'location': 4},
|
'EndCall': {'keyCode': 95, 'key': 'EndCall', 'code': 'EndCall', 'location': 4},
|
||||||
'VolumeDown': {'keyCode': 182, 'key': 'VolumeDown', 'code': 'VolumeDown', 'location': 4},
|
'VolumeDown': {'keyCode': 182, 'key': 'VolumeDown', 'code': 'VolumeDown', 'location': 4},
|
||||||
'VolumeUp': {'keyCode': 183, 'key': 'VolumeUp', 'code': 'VolumeUp', 'location': 4},
|
'VolumeUp': {'keyCode': 183, 'key': 'VolumeUp', 'code': 'VolumeUp', 'location': 4},
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user