<protected> new Device()
It is not possible to instantiate the Device class manually.
- Source:
- src/utils/Device.js line 42
Members
-
<static, nullable> onInitialized : Phaser.Signal
-
This signal is dispatched after device initialization occurs but before any of the ready callbacks (see whenReady) have been invoked.
Local "patching" for a particular device can/should be done in this event.
Note: This signal is removed after the device has been readied; if a handler has not been added before
new Phaser.Game(..)
it is probably too late.Type:
- Source:
- src/utils/Device.js line 576
-
android : boolean
-
Is running on android?
Type:
- boolean
- Source:
- src/utils/Device.js line 130
-
arora : boolean
-
Set to true if running in Arora.
Type:
- boolean
- Source:
- src/utils/Device.js line 287
-
audioData : boolean
-
Are Audio tags available?
Type:
- boolean
- Source:
- src/utils/Device.js line 397
-
cancelFullscreen : string
-
If the browser supports the Full Screen API this holds the call you need to use to cancel it.
Type:
- string
- Source:
- src/utils/Device.js line 549
-
canHandleAlpha : boolean
-
If the browser isn't capable of handling tinting with alpha this will be false.
Type:
- boolean
- Source:
- src/utils/Device.js line 181
-
canUseMultiply : boolean
-
Whether or not the Canvas Blend Modes are supported, consequently the ability to tint using the multiply method.
Expect
false
in Internet Explorer <= 11.Type:
- boolean
- Source:
- src/utils/Device.js line 191
-
canvas : boolean
-
Is canvas available?
Type:
- boolean
- Source:
- src/utils/Device.js line 168
-
canvasBitBltShift : boolean
-
True if canvas supports a 'copy' bitblt onto itself when the source and destination regions overlap.
Type:
- boolean
- Source:
- src/utils/Device.js line 174
-
chrome : boolean
-
Set to true if running in Chrome.
Type:
- boolean
- Source:
- src/utils/Device.js line 293
-
chromeOS : boolean
-
Is running on chromeOS?
Type:
- boolean
- Source:
- src/utils/Device.js line 136
-
chromeVersion : number
-
If running in Chrome this will contain the major version number.
Type:
- number
- Source:
- src/utils/Device.js line 299
-
cocoonJS : boolean
-
Is the game running under CocoonJS?
Type:
- boolean
- Source:
- src/utils/Device.js line 82
-
cocoonJSApp : boolean
-
Is this game running with CocoonJS.App?
Type:
- boolean
- Source:
- src/utils/Device.js line 88
-
cordova : boolean
-
Is the game running under Apache Cordova?
Type:
- boolean
- Source:
- src/utils/Device.js line 94
-
crosswalk : boolean
-
Is the game running under the Intel Crosswalk XDK?
Type:
- boolean
- Source:
- src/utils/Device.js line 124
-
css3D : boolean
-
Is css3D available?
Type:
- boolean
- Source:
- src/utils/Device.js line 228
-
desktop : boolean
-
Is running on a desktop?
Type:
- boolean
- Source:
- src/utils/Device.js line 64
-
<protected> deviceReadyAt : integer
-
The time the device became ready.
Type:
- integer
- Source:
- src/utils/Device.js line 49
-
dolby : boolean
-
Can this device play EC-3 Dolby Digital Plus files?
Type:
- boolean
- Source:
- src/utils/Device.js line 447
-
edge : boolean
-
Set to true if running in Microsoft Edge browser.
Type:
- boolean
- Source:
- src/utils/Device.js line 347
-
ejecta : boolean
-
Is the game running under Ejecta?
Type:
- boolean
- Source:
- src/utils/Device.js line 118
-
electron : boolean
-
Is the game running under GitHub Electron?
Type:
- boolean
- Source:
- src/utils/Device.js line 112
-
epiphany : boolean
-
Set to true if running in Epiphany.
Type:
- boolean
- Source:
- src/utils/Device.js line 305
-
file : boolean
-
Is file available?
Type:
- boolean
- Source:
- src/utils/Device.js line 204
-
fileSystem : boolean
-
Is fileSystem available?
Type:
- boolean
- Source:
- src/utils/Device.js line 210
-
firefox : boolean
-
Set to true if running in Firefox.
Type:
- boolean
- Source:
- src/utils/Device.js line 311
-
firefoxVersion : number
-
If running in Firefox this will contain the major version number.
Type:
- number
- Source:
- src/utils/Device.js line 317
-
fullscreen : boolean
-
Does the browser support the Full Screen API?
Type:
- boolean
- Source:
- src/utils/Device.js line 537
-
fullscreenKeyboard : boolean
-
Does the browser support access to the Keyboard during Full Screen mode?
Type:
- boolean
- Source:
- src/utils/Device.js line 555
-
getUserMedia : boolean
-
Does the device support the getUserMedia API?
Type:
- boolean
- Default Value:
-
- true
- Source:
- src/utils/Device.js line 252
-
h264Video : boolean
-
Can this device play h264 mp4 video files?
Type:
- boolean
- Source:
- src/utils/Device.js line 461
-
hlsVideo : boolean
-
Can this device play hls video files?
Type:
- boolean
- Source:
- src/utils/Device.js line 485
-
ie : boolean
-
Set to true if running in Internet Explorer.
Type:
- boolean
- Source:
- src/utils/Device.js line 323
-
ieVersion : number
-
If running in Internet Explorer this will contain the major version number. Beyond IE10 you should use Device.trident and Device.tridentVersion.
Type:
- number
- Source:
- src/utils/Device.js line 329
-
<protected> initialized : boolean
-
The time as which initialization has completed.
Type:
- boolean
- Source:
- src/utils/Device.js line 56
-
iOS : boolean
-
Is running on iOS?
Type:
- boolean
- Source:
- src/utils/Device.js line 70
-
iOSVersion : number
-
If running in iOS this will contain the major version number.
Type:
- number
- Source:
- src/utils/Device.js line 76
-
iPad : boolean
-
Is running on iPad?
Type:
- boolean
- Source:
- src/utils/Device.js line 505
-
iPhone : boolean
-
Is running on iPhone?
Type:
- boolean
- Source:
- src/utils/Device.js line 493
-
iPhone4 : boolean
-
Is running on iPhone4?
Type:
- boolean
- Source:
- src/utils/Device.js line 499
-
linux : boolean
-
Is running on linux?
Type:
- boolean
- Source:
- src/utils/Device.js line 142
-
LITTLE_ENDIAN : boolean
-
Same value as
littleEndian
.Type:
- boolean
- Source:
- src/utils/Device.js line 525
-
littleEndian : boolean
-
Is the device big or little endian? (only detected if the browser supports TypedArrays)
Type:
- boolean
- Source:
- src/utils/Device.js line 519
-
localStorage : boolean
-
Is localStorage available?
Type:
- boolean
- Source:
- src/utils/Device.js line 216
-
m4a : boolean
-
Can this device play m4a files? True if this device can play m4a files.
Type:
- boolean
- Source:
- src/utils/Device.js line 435
-
macOS : boolean
-
Is running on macOS?
Type:
- boolean
- Source:
- src/utils/Device.js line 148
-
midori : boolean
-
Set to true if running in Midori.
Type:
- boolean
- Source:
- src/utils/Device.js line 359
-
mobileSafari : boolean
-
Set to true if running in Mobile Safari.
Type:
- boolean
- Source:
- src/utils/Device.js line 353
-
mp3 : boolean
-
Can this device play mp3 files?
Type:
- boolean
- Source:
- src/utils/Device.js line 422
-
mp4Video : boolean
-
Can this device play h264 mp4 video files?
Type:
- boolean
- Source:
- src/utils/Device.js line 467
-
mspointer : boolean
-
Is mspointer available?
Type:
- boolean
- Source:
- src/utils/Device.js line 272
-
node : boolean
-
Is the game running under Node.js?
Type:
- boolean
- Source:
- src/utils/Device.js line 100
-
nodeWebkit : boolean
-
Is the game running under Node-Webkit?
Type:
- boolean
- Source:
- src/utils/Device.js line 106
-
ogg : boolean
-
Can this device play ogg files?
Type:
- boolean
- Source:
- src/utils/Device.js line 410
-
oggVideo : boolean
-
Can this device play ogg video files?
Type:
- boolean
- Source:
- src/utils/Device.js line 455
-
opera : boolean
-
Set to true if running in Opera.
Type:
- boolean
- Source:
- src/utils/Device.js line 365
-
opus : boolean
-
Can this device play opus files?
Type:
- boolean
- Source:
- src/utils/Device.js line 416
-
pixelRatio : number
-
PixelRatio of the host device?
Type:
- number
- Source:
- src/utils/Device.js line 513
-
pointerLock : boolean
-
Is Pointer Lock available?
Type:
- boolean
- Source:
- src/utils/Device.js line 234
-
quirksMode : boolean
-
Is the browser running in strict mode (false) or quirks mode? (true)
Type:
- boolean
- Source:
- src/utils/Device.js line 258
-
requestFullscreen : string
-
If the browser supports the Full Screen API this holds the call you need to use to activate it.
Type:
- string
- Source:
- src/utils/Device.js line 543
-
safari : boolean
-
Set to true if running in Safari.
Type:
- boolean
- Source:
- src/utils/Device.js line 371
-
safariVersion : number
-
If running in Safari this will contain the major version number.
Type:
- number
- Source:
- src/utils/Device.js line 377
-
silk : boolean
-
Set to true if running in the Silk browser (as used on the Amazon Kindle)
Type:
- boolean
- Source:
- src/utils/Device.js line 389
-
support32bit : boolean
-
Does the device context support 32bit pixel manipulation using array buffer views?
Type:
- boolean
- Source:
- src/utils/Device.js line 531
-
touch : boolean
-
Is touch available?
Type:
- boolean
- Source:
- src/utils/Device.js line 266
-
trident : boolean
-
Set to true if running a Trident version of Internet Explorer (IE11+)
Type:
- boolean
- Source:
- src/utils/Device.js line 335
-
tridentVersion : number
-
If running in Internet Explorer 11 this will contain the major version number. See http://msdn.microsoft.com/en-us/library/ie/ms537503(v=vs.85).aspx
Type:
- number
- Source:
- src/utils/Device.js line 341
-
typedArray : boolean
-
Does the browser support TypedArrays?
Type:
- boolean
- Source:
- src/utils/Device.js line 240
-
vibration : boolean
-
Does the device support the Vibration API?
Type:
- boolean
- Source:
- src/utils/Device.js line 246
-
vp9Video : boolean
-
Can this device play vp9 video files?
Type:
- boolean
- Source:
- src/utils/Device.js line 479
-
wav : boolean
-
Can this device play wav files?
Type:
- boolean
- Source:
- src/utils/Device.js line 428
-
webApp : boolean
-
Set to true if running as a WebApp, i.e. within a WebView
Type:
- boolean
- Source:
- src/utils/Device.js line 383
-
webAudio : boolean
-
Is the WebAudio API available?
Type:
- boolean
-
webGL : boolean
-
Is webGL available?
Type:
- boolean
- Source:
- src/utils/Device.js line 198
- See:
-
webm : boolean
-
Can this device play webm files?
Type:
- boolean
- Source:
- src/utils/Device.js line 441
-
webmVideo : boolean
-
Can this device play webm video files?
Type:
- boolean
- Source:
- src/utils/Device.js line 473
-
<protected> wheelEvent
-
- Source:
- src/utils/Device.js line 279
Properties:
Name Type Argument Description wheelType
string <nullable>
The newest type of Wheel/Scroll event supported: 'wheel', 'mousewheel', 'DOMMouseScroll'
-
windows : boolean
-
Is running on windows?
Type:
- boolean
- Source:
- src/utils/Device.js line 154
-
windowsPhone : boolean
-
Is running on a Windows Phone?
Type:
- boolean
- Source:
- src/utils/Device.js line 160
-
worker : boolean
-
Is worker available?
Type:
- boolean
- Source:
- src/utils/Device.js line 222
Methods
-
<static> whenReady(handler [, context] [, nonPrimer])
-
Add a device-ready handler and ensure the device ready sequence is started.
Phaser.Device will not activate or initialize until at least one
whenReady
handler is added, which is normally done automatically be callingnew Phaser.Game(..)
.The handler is invoked when the device is considered "ready", which may be immediately if the device is already "ready". See deviceReadyAt.
Parameters:
Name Type Argument Default Description handler
function Callback to invoke when the device is ready. It is invoked with the given context the Phaser.Device object is supplied as the first argument.
context
object <optional>
Context in which to invoke the handler
nonPrimer
boolean <optional>
false If true the device ready check will not be started.
- Source:
- src/utils/Device.js line 592
-
canPlayAudio(type)
-
Check whether the host environment can play audio.
Parameters:
Name Type Description type
string One of 'mp3, 'ogg', 'm4a', 'wav', 'webm' or 'opus'.
- Source:
- src/utils/Device.js line 1340
Returns:
True if the given file type is supported by the browser, otherwise false.
- Type
- boolean
-
canPlayVideo(type)
-
Check whether the host environment can play video files.
Parameters:
Name Type Description type
string One of 'mp4, 'ogg', 'webm' or 'mpeg'.
- Source:
- src/utils/Device.js line 1382
Returns:
True if the given file type is supported by the browser, otherwise false.
- Type
- boolean
-
isAndroidStockBrowser()
-
Detect if the host is a an Android Stock browser. This is available before the device "ready" event.
Authors might want to scale down on effects and switch to the CANVAS rendering method on those devices.
- Source:
- src/utils/Device.js line 1424
Example
var defaultRenderingMode = Phaser.Device.isAndroidStockBrowser() ? Phaser.CANVAS : Phaser.AUTO;
-
needsTouchUnlock()
-
Whether the device plays audio/video only in response to a user touch event.
- Source:
- src/utils/Device.js line 1412
Returns:
- Type
- boolean