Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Adding TS typings. #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions lib/keyboard-layout.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
declare module 'keyboard-layout' {
/**
* Returns characters for various modifier states based on a DOM 3
* KeyboardEvent.code value and the current system keyboard layout
*/
export function getCurrentKeymap(): any;

/**
* Get the current keyboard layout
*
* @returns The identifier of the current layout based on the value returned
* by the operating system
*/
export function getCurrentKeyboardLayout(): string;

/**
* Get the current keyboard language
*
* @returns The keyboard language
*/
export function getCurrentKeyboardLanguage(): string;

/**
* List all installed keyboard languages
*
* @returns All keyboard languages
*/
export function getInstalledKeyboardLanguages(): string[];

/**
* Get the current keyboard layout, invoking the callback once immediately
* with the current layout value and then again next time it changes
*/
export function observeCurrentKeyboardLayout(callback: Function): any;

/**
* Get the current keyboard layout, invoking the callback once the keyboard
* changes, not changing it for the current set upt
*/
export function onDidChangeCurrentKeyboardLayout(callback: Function): any;
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "2.0.14",
"description": "Read and observe the current keyboard layout on OS X.",
"main": "./lib/keyboard-layout",
"types": "./lib/keyboard-layout.d.ts",
"scripts": {
"test": "jasmine-focused --captureExceptions --forceexit spec"
},
Expand Down