mirror of
https://github.com/hodgef/simple-keyboard.git
synced 2025-01-20 09:45:37 +08:00
Adding types for recurseButtons method. Per https://github.com/hodgef/react-simple-keyboard/issues/960
This commit is contained in:
parent
9be8a095e0
commit
1166a2824f
5
src/lib/@types/index.d.ts
vendored
5
src/lib/@types/index.d.ts
vendored
@ -312,6 +312,11 @@ declare module 'simple-keyboard' {
|
||||
* Clears keyboard listeners and DOM elements.
|
||||
*/
|
||||
destroy(): void;
|
||||
|
||||
/**
|
||||
* Iterate on each button (ForEach)
|
||||
*/
|
||||
recurseButtons(fn: any): void;
|
||||
}
|
||||
|
||||
export default Keyboard;
|
||||
|
@ -880,7 +880,7 @@ class SimpleKeyboard {
|
||||
* Execute an operation on each button
|
||||
*/
|
||||
recurseButtons(fn) {
|
||||
if (!fn) return false;
|
||||
if (!fn) return;
|
||||
|
||||
Object.keys(this.buttonElements).forEach(buttonName =>
|
||||
this.buttonElements[buttonName].forEach(fn)
|
||||
|
@ -1376,7 +1376,7 @@ it('Keyboard buttonAttribute will warn about invalid entries', () => {
|
||||
it('Keyboard recurseButtons will not work without a valid param', () => {
|
||||
setDOM();
|
||||
const keyboard = new Keyboard();
|
||||
expect(keyboard.recurseButtons()).toBe(false);
|
||||
expect(keyboard.recurseButtons()).toBeFalsy();
|
||||
});
|
||||
|
||||
it('Keyboard will not work with a DOM element param without class', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user