1 | ;
|
2 | /*-----------------------------------------------------------------------------
|
3 | | Copyright (c) 2014-2017, PhosphorJS Contributors
|
4 | |
|
5 | | Distributed under the terms of the BSD 3-Clause License.
|
6 | |
|
7 | | The full license is in the file LICENSE, distributed with this software.
|
8 | |----------------------------------------------------------------------------*/
|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
10 | /**
|
11 | * The namespace for platform related utilities.
|
12 | */
|
13 | var Platform;
|
14 | (function (Platform) {
|
15 | /**
|
16 | * A flag indicating whether the platform is Mac.
|
17 | */
|
18 | Platform.IS_MAC = !!navigator.platform.match(/Mac/i);
|
19 | /**
|
20 | * A flag indicating whether the platform is Windows.
|
21 | */
|
22 | Platform.IS_WIN = !!navigator.platform.match(/Win/i);
|
23 | /**
|
24 | * A flag indicating whether the browser is IE.
|
25 | */
|
26 | Platform.IS_IE = /Trident/.test(navigator.userAgent);
|
27 | /**
|
28 | * A flag indicating whether the browser is Edge.
|
29 | */
|
30 | Platform.IS_EDGE = /Edge/.test(navigator.userAgent);
|
31 | /**
|
32 | * Test whether the `accel` key is pressed.
|
33 | *
|
34 | * @param event - The keyboard or mouse event of interest.
|
35 | *
|
36 | * @returns Whether the `accel` key is pressed.
|
37 | *
|
38 | * #### Notes
|
39 | * On Mac the `accel` key is the command key. On all other
|
40 | * platforms the `accel` key is the control key.
|
41 | */
|
42 | function accelKey(event) {
|
43 | return Platform.IS_MAC ? event.metaKey : event.ctrlKey;
|
44 | }
|
45 | Platform.accelKey = accelKey;
|
46 | })(Platform = exports.Platform || (exports.Platform = {}));
|