Class: Phaser.Device
Constructor
<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 code: utils/Device.js (Line 30)
Public Properties
- Source code: utils/Device.js (Line 544)
- Source code: utils/Device.js (Line 118)
- Source code: utils/Device.js (Line 257)
- Source code: utils/Device.js (Line 367)
- Source code: utils/Device.js (Line 518)
- Source code: utils/Device.js (Line 156)
- Source code: utils/Device.js (Line 162)
- Source code: utils/Device.js (Line 263)
- Source code: utils/Device.js (Line 124)
- Source code: utils/Device.js (Line 269)
- Source code: utils/Device.js (Line 70)
- Source code: utils/Device.js (Line 76)
- Source code: utils/Device.js (Line 82)
- Source code: utils/Device.js (Line 112)
- Source code: utils/Device.js (Line 198)
- Source code: utils/Device.js (Line 52)
- Internal:
- This member is internal (protected) and may be modified or removed in the future.
- Source code: utils/Device.js (Line 37)
- Source code: utils/Device.js (Line 416)
- Source code: utils/Device.js (Line 317)
- Source code: utils/Device.js (Line 106)
- Source code: utils/Device.js (Line 100)
- Source code: utils/Device.js (Line 275)
- Source code: utils/Device.js (Line 174)
- Source code: utils/Device.js (Line 180)
- Source code: utils/Device.js (Line 281)
- Source code: utils/Device.js (Line 287)
- Source code: utils/Device.js (Line 506)
- Source code: utils/Device.js (Line 524)
- Default Value
- true
- Source code: utils/Device.js (Line 222)
- Source code: utils/Device.js (Line 430)
- Source code: utils/Device.js (Line 454)
- Source code: utils/Device.js (Line 293)
- Source code: utils/Device.js (Line 299)
- Internal:
- This member is internal (protected) and may be modified or removed in the future.
- Source code: utils/Device.js (Line 44)
- Source code: utils/Device.js (Line 58)
- Source code: utils/Device.js (Line 64)
- Source code: utils/Device.js (Line 474)
- Source code: utils/Device.js (Line 462)
- Source code: utils/Device.js (Line 468)
- Source code: utils/Device.js (Line 130)
- Source code: utils/Device.js (Line 494)
- Source code: utils/Device.js (Line 488)
- Source code: utils/Device.js (Line 186)
- Source code: utils/Device.js (Line 404)
- Source code: utils/Device.js (Line 136)
- Source code: utils/Device.js (Line 329)
- Source code: utils/Device.js (Line 323)
- Source code: utils/Device.js (Line 391)
- Source code: utils/Device.js (Line 436)
- Source code: utils/Device.js (Line 242)
- Source code: utils/Device.js (Line 88)
- Source code: utils/Device.js (Line 94)
- Source code: utils/Device.js (Line 379)
- Source code: utils/Device.js (Line 424)
- Source code: utils/Device.js (Line 335)
- Source code: utils/Device.js (Line 385)
- Source code: utils/Device.js (Line 482)
- Source code: utils/Device.js (Line 204)
- Source code: utils/Device.js (Line 228)
- Source code: utils/Device.js (Line 512)
- Source code: utils/Device.js (Line 341)
- Source code: utils/Device.js (Line 347)
- Source code: utils/Device.js (Line 359)
- Source code: utils/Device.js (Line 500)
- Source code: utils/Device.js (Line 236)
- Source code: utils/Device.js (Line 305)
- Source code: utils/Device.js (Line 311)
- Source code: utils/Device.js (Line 210)
- Source code: utils/Device.js (Line 216)
- Source code: utils/Device.js (Line 448)
- Source code: utils/Device.js (Line 397)
- Source code: utils/Device.js (Line 353)
- Source code: utils/Device.js (Line 373)
- Source code: utils/Device.js (Line 168)
- Source code: utils/Device.js (Line 410)
- Source code: utils/Device.js (Line 442)
- Internal:
- This member is internal (protected) and may be modified or removed in the future.
- Source code: utils/Device.js (Line 249)
- Source code: utils/Device.js (Line 142)
- Source code: utils/Device.js (Line 148)
- Source code: utils/Device.js (Line 192)
<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.
android : boolean
Is running on android?
arora : boolean
Set to true if running in Arora.
audioData : boolean
Are Audio tags available?
cancelFullscreen : string
If the browser supports the Full Screen API this holds the call you need to use to cancel it.
canvas : boolean
Is canvas available?
canvasBitBltShift : boolean
True if canvas supports a 'copy' bitblt onto itself when the source and destination regions overlap.
chrome : boolean
Set to true if running in Chrome.
chromeOS : boolean
Is running on chromeOS?
chromeVersion : number
If running in Chrome this will contain the major version number.
cocoonJS : boolean
Is the game running under CocoonJS?
cocoonJSApp : boolean
Is this game running with CocoonJS.App?
cordova : boolean
Is the game running under Apache Cordova?
crosswalk : boolean
Is the game running under the Intel Crosswalk XDK?
css3D : boolean
Is css3D available?
desktop : boolean
Is running on a desktop?
<internal> deviceReadyAt : integer
The time the device became ready.
dolby : boolean
Can this device play EC-3 Dolby Digital Plus files?
edge : boolean
Set to true if running in Microsoft Edge browser.
ejecta : boolean
Is the game running under Ejecta?
electron : boolean
Is the game running under GitHub Electron?
epiphany : boolean
Set to true if running in Epiphany.
file : boolean
Is file available?
fileSystem : boolean
Is fileSystem available?
firefox : boolean
Set to true if running in Firefox.
firefoxVersion : number
If running in Firefox this will contain the major version number.
fullscreen : boolean
Does the browser support the Full Screen API?
fullscreenKeyboard : boolean
Does the browser support access to the Keyboard during Full Screen mode?
getUserMedia : boolean
Does the device support the getUserMedia API?
h264Video : boolean
Can this device play h264 mp4 video files?
hlsVideo : boolean
Can this device play hls video files?
ie : boolean
Set to true if running in Internet Explorer.
ieVersion : number
If running in Internet Explorer this will contain the major version number. Beyond IE10 you should use Device.trident and Device.tridentVersion.
<internal> initialized : boolean
The time as which initialization has completed.
iOS : boolean
Is running on iOS?
iOSVersion : number
If running in iOS this will contain the major version number.
iPad : boolean
Is running on iPad?
iPhone : boolean
Is running on iPhone?
iPhone4 : boolean
Is running on iPhone4?
linux : boolean
Is running on linux?
LITTLE_ENDIAN : boolean
Same value as littleEndian
.
littleEndian : boolean
Is the device big or little endian? (only detected if the browser supports TypedArrays)
localStorage : boolean
Is localStorage available?
m4a : boolean
Can this device play m4a files? True if this device can play m4a files.
macOS : boolean
Is running on macOS?
midori : boolean
Set to true if running in Midori.
mobileSafari : boolean
Set to true if running in Mobile Safari.
mp3 : boolean
Can this device play mp3 files?
mp4Video : boolean
Can this device play h264 mp4 video files?
mspointer : boolean
Is mspointer available?
node : boolean
Is the game running under Node.js?
nodeWebkit : boolean
Is the game running under Node-Webkit?
ogg : boolean
Can this device play ogg files?
oggVideo : boolean
Can this device play ogg video files?
opera : boolean
Set to true if running in Opera.
opus : boolean
Can this device play opus files?
pixelRatio : number
PixelRatio of the host device?
pointerLock : boolean
Is Pointer Lock available?
quirksMode : boolean
Is the browser running in strict mode (false) or quirks mode? (true)
requestFullscreen : string
If the browser supports the Full Screen API this holds the call you need to use to activate it.
safari : boolean
Set to true if running in Safari.
safariVersion : number
If running in Safari this will contain the major version number.
silk : boolean
Set to true if running in the Silk browser (as used on the Amazon Kindle)
support32bit : boolean
Does the device context support 32bit pixel manipulation using array buffer views?
touch : boolean
Is touch available?
trident : boolean
Set to true if running a Trident version of Internet Explorer (IE11+)
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
typedArray : boolean
Does the browser support TypedArrays?
vibration : boolean
Does the device support the Vibration API?
vp9Video : boolean
Can this device play vp9 video files?
wav : boolean
Can this device play wav files?
webApp : boolean
Set to true if running as a WebApp, i.e. within a WebView
webAudio : boolean
Is the WebAudio API available?
webGL : boolean
Is webGL available?
webm : boolean
Can this device play webm files?
webmVideo : boolean
Can this device play webm video files?
<internal> wheelEvent
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?
windowsPhone : boolean
Is running on a Windows Phone?
worker : boolean
Is worker available?
Public Methods
- Source code: utils/Device.js (Line 560)
- Source code: utils/Device.js (Line 1250)
- Source code: utils/Device.js (Line 1293)
- Source code: utils/Device.js (Line 1359)
- Source code: utils/Device.js (Line 1324)
<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 calling new 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. |
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
True if the given file type is supported by the browser, otherwise false.
canPlayVideo(type) → {boolean}
Check whether the host environment can play video files.
Parameters
Name | Type | Description |
---|---|---|
type | string | One of 'mp4, 'ogg', 'webm' or 'mpeg'. |
Returns
True if the given file type is supported by the browser, otherwise false.
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.
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
© 2016 Richard Davey, Photon Storm Ltd.
Licensed under the MIT License.
http://phaser.io/docs/2.6.2/Phaser.Device.html