keyboard-layout
Advanced tools
Comparing version 1.3.1 to 2.0.0
@@ -7,11 +7,5 @@ 'use strict' | ||
const emitter = new Emitter() | ||
const keymapsByLayoutName = new Map() | ||
let currentKeymap = null | ||
let currentKeyboardLayout = null | ||
let currentKeyboardLanguage = null | ||
const manager = new KeyboardLayoutManager(() => { | ||
currentKeymap = null | ||
currentKeyboardLayout = null | ||
currentKeyboardLanguage = null | ||
emitter.emit('did-change-current-keyboard-layout', getCurrentKeyboardLayout()) | ||
@@ -21,4 +15,7 @@ }) | ||
function getCurrentKeymap () { | ||
const currentLayout = getCurrentKeyboardLayout() | ||
let currentKeymap = keymapsByLayoutName.get(currentLayout) | ||
if (!currentKeymap) { | ||
currentKeymap = manager.getCurrentKeymap() | ||
keymapsByLayoutName.set(currentLayout, currentKeymap) | ||
} | ||
@@ -29,13 +26,7 @@ return currentKeymap | ||
function getCurrentKeyboardLayout () { | ||
if (!currentKeyboardLayout) { | ||
currentKeyboardLayout = manager.getCurrentKeyboardLayout() | ||
} | ||
return currentKeyboardLayout | ||
return manager.getCurrentKeyboardLayout() | ||
} | ||
function getCurrentKeyboardLanguage () { | ||
if (!currentKeyboardLanguage) { | ||
currentKeyboardLanguage = manager.getCurrentKeyboardLanguage() | ||
} | ||
return currentKeyboardLanguage | ||
return manager.getCurrentKeyboardLanguage() | ||
} | ||
@@ -42,0 +33,0 @@ |
{ | ||
"name": "keyboard-layout", | ||
"version": "1.3.1", | ||
"version": "2.0.0", | ||
"description": "Read and observe the current keyboard layout on OS X.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/keyboard-layout", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
62591
45