<internal> new Device()
It is not possible to instantiate the Device class manually.
- Internal:
- This member is internal (protected) and may be modified or removed in the future.
- Source - system/Device.js, line 30
Members
-
<static> 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.- Source - system/Device.js, line 456
-
android :boolean
-
Is running on android?
- Default Value:
- false
- Source - system/Device.js, line 106
-
arora :boolean
-
Set to true if running in Arora.
- Default Value:
- false
- Source - system/Device.js, line 239
-
audioData :boolean
-
Are Audio tags available?
- Default Value:
- false
- Source - system/Device.js, line 325
-
cancelFullscreen :string
-
If the browser supports the Full Screen API this holds the call you need to use to cancel it.
- Source - system/Device.js, line 430
-
canvas :boolean
-
Is canvas available?
- Default Value:
- false
- Source - system/Device.js, line 144
-
chrome :boolean
-
Set to true if running in Chrome.
- Default Value:
- false
- Source - system/Device.js, line 245
-
chromeOS :boolean
-
Is running on chromeOS?
- Default Value:
- false
- Source - system/Device.js, line 112
-
cocoonJS :boolean
-
Is the game running under CocoonJS?
- Default Value:
- false
- Source - system/Device.js, line 64
-
cocoonJSApp :boolean
-
Is this game running with CocoonJS.App?
- Default Value:
- false
- Source - system/Device.js, line 70
-
cordova :boolean
-
Is the game running under Apache Cordova?
- Default Value:
- false
- Source - system/Device.js, line 76
-
crosswalk :boolean
-
Is the game running under the Intel Crosswalk XDK?
- Default Value:
- false
- Source - system/Device.js, line 100
-
css3D :boolean
-
Is css3D available?
- Default Value:
- false
- Source - system/Device.js, line 180
-
desktop :boolean
-
Is running on a desktop?
- Default Value:
- false
- Source - system/Device.js, line 52
-
<internal> deviceReadyAt :integer
-
The time the device became ready.
- Internal:
- This member is internal (protected) and may be modified or removed in the future.
- Source - system/Device.js, line 37
-
ejecta :boolean
-
Is the game running under Ejecta?
- Default Value:
- false
- Source - system/Device.js, line 94
-
epiphany :boolean
-
Set to true if running in Epiphany.
- Default Value:
- false
- Source - system/Device.js, line 251
-
file :boolean
-
Is file available?
- Default Value:
- false
- Source - system/Device.js, line 150
-
fileSystem :boolean
-
Is fileSystem available?
- Default Value:
- false
- Source - system/Device.js, line 156
-
firefox :boolean
-
Set to true if running in Firefox.
- Default Value:
- false
- Source - system/Device.js, line 257
-
fullscreen :boolean
-
Does the browser support the Full Screen API?
- Default Value:
- false
- Source - system/Device.js, line 418
-
fullscreenKeyboard :boolean
-
Does the browser support access to the Keyboard during Full Screen mode?
- Default Value:
- false
- Source - system/Device.js, line 436
-
getUserMedia :boolean
-
Does the device support the getUserMedia API?
- Default Value:
- false
- Source - system/Device.js, line 204
-
ie :boolean
-
Set to true if running in Internet Explorer.
- Default Value:
- false
- Source - system/Device.js, line 263
-
ieVersion :number
-
If running in Internet Explorer this will contain the major version number. Beyond IE10 you should use Device.trident and Device.tridentVersion.
- Default Value:
- 0
- Source - system/Device.js, line 269
-
<internal> initialized :boolean
-
The time as which initialization has completed.
- Internal:
- This member is internal (protected) and may be modified or removed in the future.
- Source - system/Device.js, line 44
-
iOS :boolean
-
Is running on iOS?
- Default Value:
- false
- Source - system/Device.js, line 58
-
iPad :boolean
-
Is running on iPad?
- Default Value:
- false
- Source - system/Device.js, line 388
-
iPhone :boolean
-
Is running on iPhone?
- Default Value:
- false
- Source - system/Device.js, line 376
-
iPhone4 :boolean
-
Is running on iPhone4?
- Default Value:
- false
- Source - system/Device.js, line 382
-
linux :boolean
-
Is running on linux?
- Default Value:
- false
- Source - system/Device.js, line 118
-
LITTLE_ENDIAN :boolean
-
Same value as
littleEndian
.- Default Value:
- false
- Source - system/Device.js, line 406
-
littleEndian :boolean
-
Is the device big or little endian? (only detected if the browser supports TypedArrays)
- Default Value:
- false
- Source - system/Device.js, line 400
-
localStorage :boolean
-
Is localStorage available?
- Default Value:
- false
- Source - system/Device.js, line 162
-
m4a :boolean
-
Can this device play m4a files? True if this device can play m4a files.
- Default Value:
- false
- Source - system/Device.js, line 362
-
macOS :boolean
-
Is running on macOS?
- Default Value:
- false
- Source - system/Device.js, line 124
-
midori :boolean
-
Set to true if running in Midori.
- Default Value:
- false
- Source - system/Device.js, line 293
-
mobileSafari :boolean
-
Set to true if running in Mobile Safari.
- Default Value:
- false
- Source - system/Device.js, line 287
-
mp3 :boolean
-
Can this device play mp3 files?
- Default Value:
- false
- Source - system/Device.js, line 349
-
mspointer :boolean
-
Is mspointer available?
- Default Value:
- false
- Source - system/Device.js, line 224
-
node :boolean
-
Is the game running under Node.js?
- Default Value:
- false
- Source - system/Device.js, line 82
-
nodeWebkit :boolean
-
Is the game running under Node-Webkit?
- Default Value:
- false
- Source - system/Device.js, line 88
-
ogg :boolean
-
Can this device play ogg files?
- Default Value:
- false
- Source - system/Device.js, line 337
-
opera :boolean
-
Set to true if running in Opera.
- Default Value:
- false
- Source - system/Device.js, line 299
-
opus :boolean
-
Can this device play opus files?
- Default Value:
- false
- Source - system/Device.js, line 343
-
pixelRatio :number
-
PixelRatio of the host device?
- Default Value:
- 0
- Source - system/Device.js, line 394
-
pointerLock :boolean
-
Is Pointer Lock available?
- Default Value:
- false
- Source - system/Device.js, line 186
-
quirksMode :boolean
-
Is the browser running in strict mode (false) or quirks mode? (true)
- Default Value:
- false
- Source - system/Device.js, line 210
-
requestFullscreen :string
-
If the browser supports the Full Screen API this holds the call you need to use to activate it.
- Source - system/Device.js, line 424
-
safari :boolean
-
Set to true if running in Safari.
- Default Value:
- false
- Source - system/Device.js, line 305
-
silk :boolean
-
Set to true if running in the Silk browser (as used on the Amazon Kindle)
- Default Value:
- false
- Source - system/Device.js, line 317
-
support32bit :boolean
-
Does the device context support 32bit pixel manipulation using array buffer views?
- Default Value:
- false
- Source - system/Device.js, line 412
-
touch :boolean
-
Is touch available?
- Default Value:
- false
- Source - system/Device.js, line 218
-
trident :boolean
-
Set to true if running a Trident version of Internet Explorer (IE11+)
- Default Value:
- false
- Source - system/Device.js, line 275
-
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}
- Default Value:
- 0
- Source - system/Device.js, line 281
-
typedArray :boolean
-
Does the browser support TypedArrays?
- Default Value:
- false
- Source - system/Device.js, line 192
-
vibration :boolean
-
Does the device support the Vibration API?
- Default Value:
- false
- Source - system/Device.js, line 198
-
wav :boolean
-
Can this device play wav files?
- Default Value:
- false
- Source - system/Device.js, line 355
-
webApp :boolean
-
Set to true if running as a WebApp, i.e. within a WebView
- Default Value:
- false
- Source - system/Device.js, line 311
-
webAudio :boolean
-
Is the WebAudio API available?
- Default Value:
- false
- Source - system/Device.js, line 331
-
webGL :boolean
-
Is webGL available?
- Default Value:
- false
- Source - system/Device.js, line 168
-
webm :boolean
-
Can this device play webm files?
- Default Value:
- false
- Source - system/Device.js, line 368
-
<internal> wheelEvent
-
- Internal:
- This member is internal (protected) and may be modified or removed in the future.
- Default Value:
- null
- Source - system/Device.js, line 231
Properties:
Name Type Description wheelType
string | null The newest type of Wheel/Scroll event supported: 'wheel', 'mousewheel', 'DOMMouseScroll'
-
windows :boolean
-
Is running on windows?
- Default Value:
- false
- Source - system/Device.js, line 130
-
windowsPhone :boolean
-
Is running on a Windows Phone?
- Default Value:
- false
- Source - system/Device.js, line 136
-
worker :boolean
-
Is worker available?
- Default Value:
- false
- Source - system/Device.js, line 174
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 - system/Device.js, line 472
-
canPlayAudio(type) → {boolean}
-
Check whether the host environment can play audio.
Parameters:
Name Type Description type
string One of 'mp3, 'ogg', 'm4a', 'wav', 'webm' or 'opus'.
Returns:
boolean -True if the given file type is supported by the browser, otherwise false.
- Source - system/Device.js, line 1061
-
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 - system/Device.js, line 1135
Example
var defaultRenderingMode = Phaser.Device.isAndroidStockBrowser() ? Phaser.CANVAS : Phaser.AUTO;
-
isConsoleOpen()
-
Check whether the console is open. Note that this only works in Firefox with Firebug and earlier versions of Chrome. It used to work in Chrome, but then they removed the ability: ">http://src.chromium.org/viewvc/blink?view=revision&revision=151136}
- Source - system/Device.js, line 1100