@wordpress/keycodes
Advanced tools
Comparing version 2.18.3 to 2.18.4-next.53e2173694.0
@@ -42,4 +42,2 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
/* eslint-disable jsdoc/valid-types */ | ||
/** | ||
@@ -53,4 +51,2 @@ * @template T | ||
/* eslint-enable jsdoc/valid-types */ | ||
/** | ||
@@ -57,0 +53,0 @@ * Keycode for BACKSPACE key. |
@@ -8,3 +8,3 @@ /** | ||
* | ||
* @param {Window} _window window object by default; used for DI testing. | ||
* @param {Window?} _window window object by default; used for DI testing. | ||
* | ||
@@ -15,4 +15,12 @@ * @return {boolean} True if MacOS; false otherwise. | ||
export function isAppleOS() { | ||
var _window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window; | ||
var _window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; | ||
if (!_window) { | ||
if (typeof window === 'undefined') { | ||
return false; | ||
} | ||
_window = window; | ||
} | ||
var platform = _window.navigator.platform; | ||
@@ -19,0 +27,0 @@ return platform.indexOf('Mac') !== -1 || includes(['iPad', 'iPhone'], platform); |
/** | ||
* Return true if platform is MacOS. | ||
* | ||
* @param {Window} _window window object by default; used for DI testing. | ||
* @param {Window?} _window window object by default; used for DI testing. | ||
* | ||
* @return {boolean} True if MacOS; false otherwise. | ||
*/ | ||
export function isAppleOS(_window?: Window): boolean; | ||
export function isAppleOS(_window?: Window | null): boolean; | ||
//# sourceMappingURL=platform.d.ts.map |
@@ -56,4 +56,2 @@ "use strict"; | ||
/* eslint-disable jsdoc/valid-types */ | ||
/** | ||
@@ -67,4 +65,2 @@ * @template T | ||
/* eslint-enable jsdoc/valid-types */ | ||
/** | ||
@@ -71,0 +67,0 @@ * Keycode for BACKSPACE key. |
@@ -17,3 +17,3 @@ "use strict"; | ||
* | ||
* @param {Window} _window window object by default; used for DI testing. | ||
* @param {Window?} _window window object by default; used for DI testing. | ||
* | ||
@@ -23,4 +23,12 @@ * @return {boolean} True if MacOS; false otherwise. | ||
function isAppleOS() { | ||
var _window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window; | ||
var _window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; | ||
if (!_window) { | ||
if (typeof window === 'undefined') { | ||
return false; | ||
} | ||
_window = window; | ||
} | ||
var platform = _window.navigator.platform; | ||
@@ -27,0 +35,0 @@ return platform.indexOf('Mac') !== -1 || (0, _lodash.includes)(['iPad', 'iPhone'], platform); |
{ | ||
"name": "@wordpress/keycodes", | ||
"version": "2.18.3", | ||
"version": "2.18.4-next.53e2173694.0", | ||
"description": "Keycodes utilities for WordPress. Used to check for keyboard events across browsers/operating systems.", | ||
@@ -28,3 +28,3 @@ "author": "The WordPress Contributors", | ||
"@babel/runtime": "^7.12.5", | ||
"@wordpress/i18n": "^3.18.0", | ||
"@wordpress/i18n": "^3.19.1-next.53e2173694.0", | ||
"lodash": "^4.17.19" | ||
@@ -35,3 +35,3 @@ }, | ||
}, | ||
"gitHead": "76eba7cb18dbb129b1b1ddf9fd4a8a87bace0962" | ||
"gitHead": "cac63ac5e871791c3ea5bc6a5a7dd06d6229cccb" | ||
} |
@@ -91,3 +91,3 @@ # Keycodes | ||
- `WPModifierHandler<WPKeyHandler<Array<string>>>` Keyed map of functions to shortcut sequences. | ||
- `WPModifierHandler<WPKeyHandler<string[]>>` Keyed map of functions to shortcut sequences. | ||
@@ -138,3 +138,3 @@ <a name="DOWN" href="#DOWN">#</a> **DOWN** | ||
- (unknown type) | ||
- `WPModifierHandler< ( isApple: () => boolean ) => WPModifierPart[]>` | ||
@@ -141,0 +141,0 @@ <a name="rawShortcut" href="#rawShortcut">#</a> **rawShortcut** |
@@ -40,3 +40,2 @@ /** | ||
/* eslint-disable jsdoc/valid-types */ | ||
/** | ||
@@ -48,3 +47,2 @@ * @template T | ||
/** @typedef {(event: KeyboardEvent, character: string, isApple?: () => boolean) => boolean} WPEventKeyHandler */ | ||
/* eslint-enable jsdoc/valid-types */ | ||
@@ -51,0 +49,0 @@ /** |
@@ -9,7 +9,15 @@ /** | ||
* | ||
* @param {Window} _window window object by default; used for DI testing. | ||
* @param {Window?} _window window object by default; used for DI testing. | ||
* | ||
* @return {boolean} True if MacOS; false otherwise. | ||
*/ | ||
export function isAppleOS( _window = window ) { | ||
export function isAppleOS( _window = null ) { | ||
if ( ! _window ) { | ||
if ( typeof window === 'undefined' ) { | ||
return false; | ||
} | ||
_window = window; | ||
} | ||
const { platform } = _window.navigator; | ||
@@ -16,0 +24,0 @@ |
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
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
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
163587
1788
1