Class: Device

Phaser. Device

Phaser.Device

new Device()

Detects device support capabilities. Using some elements from System.js by MrDoob and Modernizr

Source:

Members

android

Properties:
Name Type Description
android boolean

Is running on android?

Default Value:
  • false
Source:

arora

Properties:
Name Type Description
arora boolean

Set to true if running in Arora.

Default Value:
  • false
Source:

audioData

Properties:
Name Type Description
audioData boolean

Are Audio tags available?

Default Value:
  • false
Source:

cancelFullscreen

Properties:
Name Type Description
cancelFullscreen string

If the browser supports the Full Screen API this holds the call you need to use to cancel it.

Source:

canvas

Properties:
Name Type Description
canvas boolean

Is canvas available?

Default Value:
  • false
Source:

chrome

Properties:
Name Type Description
chrome boolean

Set to true if running in Chrome.

Default Value:
  • false
Source:

chromeOS

Properties:
Name Type Description
chromeOS boolean

Is running on chromeOS?

Default Value:
  • false
Source:

cocoonJS

Properties:
Name Type Description
cocoonJS boolean

Is the game running under CocoonJS?

Default Value:
  • false
Source:

crosswalk

Properties:
Name Type Description
crosswalk boolean

Is the game running under the Intel Crosswalk XDK?

Default Value:
  • false
Source:

css3D

Properties:
Name Type Description
css3D boolean

Is css3D available?

Default Value:
  • false
Source:

desktop

Properties:
Name Type Description
desktop boolean

Is running desktop?

Default Value:
  • false
Source:

ejecta

Properties:
Name Type Description
ejecta boolean

Is the game running under Ejecta?

Default Value:
  • false
Source:

epiphany

Properties:
Name Type Description
epiphany boolean

Set to true if running in Epiphany.

Default Value:
  • false
Source:

file

Properties:
Name Type Description
file boolean

Is file available?

Default Value:
  • false
Source:

fileSystem

Properties:
Name Type Description
fileSystem boolean

Is fileSystem available?

Default Value:
  • false
Source:

firefox

Properties:
Name Type Description
firefox boolean

Set to true if running in Firefox.

Default Value:
  • false
Source:

fullscreen

Properties:
Name Type Description
fullscreen boolean

Does the browser support the Full Screen API?

Default Value:
  • false
Source:

fullscreenKeyboard

Properties:
Name Type Description
fullscreenKeyboard boolean

Does the browser support access to the Keyboard during Full Screen mode?

Default Value:
  • false
Source:

game

Properties:
Name Type Description
game Phaser.Game

A reference to the currently running game.

Source:

getUserMedia

Properties:
Name Type Description
getUserMedia boolean

Does the device support the getUserMedia API?

Default Value:
  • false
Source:

ie

Properties:
Name Type Description
ie boolean

Set to true if running in Internet Explorer.

Default Value:
  • false
Source:

ieVersion

Properties:
Name Type Description
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:

iOS

Properties:
Name Type Description
iOS boolean

Is running on iOS?

Default Value:
  • false
Source:

iPad

Properties:
Name Type Description
iPad boolean

Is running on iPad?

Default Value:
  • false
Source:

iPhone

Properties:
Name Type Description
iPhone boolean

Is running on iPhone?

Default Value:
  • false
Source:

iPhone4

Properties:
Name Type Description
iPhone4 boolean

Is running on iPhone4?

Default Value:
  • false
Source:

linux

Properties:
Name Type Description
linux boolean

Is running on linux?

Default Value:
  • false
Source:

littleEndian

Properties:
Name Type Description
littleEndian boolean

Is the device big or little endian? (only detected if the browser supports TypedArrays)

Default Value:
  • false
Source:

localStorage

Properties:
Name Type Description
localStorage boolean

Is localStorage available?

Default Value:
  • false
Source:

m4a

Can this device play m4a files?

Properties:
Name Type Description
m4a boolean

True if this device can play m4a files.

Default Value:
  • false
Source:

macOS

Properties:
Name Type Description
macOS boolean

Is running on macOS?

Default Value:
  • false
Source:

midori

Properties:
Name Type Description
midori boolean

Set to true if running in Midori.

Default Value:
  • false
Source:

mobileSafari

Properties:
Name Type Description
mobileSafari boolean

Set to true if running in Mobile Safari.

Default Value:
  • false
Source:

mp3

Properties:
Name Type Description
mp3 boolean

Can this device play mp3 files?

Default Value:
  • false
Source:

mspointer

Properties:
Name Type Description
mspointer boolean

Is mspointer available?

Default Value:
  • false
Source:

ogg

Properties:
Name Type Description
ogg boolean

Can this device play ogg files?

Default Value:
  • false
Source:

opera

Properties:
Name Type Description
opera boolean

Set to true if running in Opera.

Default Value:
  • false
Source:

opus

Properties:
Name Type Description
opus boolean

Can this device play opus files?

Default Value:
  • false
Source:

pixelRatio

Properties:
Name Type Description
pixelRatio number

PixelRatio of the host device?

Default Value:
  • 0
Source:

pointerLock

Properties:
Name Type Description
pointerLock boolean

Is Pointer Lock available?

Default Value:
  • false
Source:

quirksMode

Properties:
Name Type Description
quirksMode boolean

Is the browser running in strict mode (false) or quirks mode? (true)

Default Value:
  • false
Source:

requestFullscreen

Properties:
Name Type Description
requestFullscreen string

If the browser supports the Full Screen API this holds the call you need to use to activate it.

Source:

safari

Properties:
Name Type Description
safari boolean

Set to true if running in Safari.

Default Value:
  • false
Source:

silk

Properties:
Name Type Description
silk boolean

Set to true if running in the Silk browser (as used on the Amazon Kindle)

Default Value:
  • false
Source:

support32bit

Properties:
Name Type Description
support32bit boolean

Does the device context support 32bit pixel manipulation using array buffer views?

Default Value:
  • false
Source:

touch

Properties:
Name Type Description
touch boolean

Is touch available?

Default Value:
  • false
Source:

trident

Properties:
Name Type Description
trident boolean

Set to true if running a Trident version of Internet Explorer (IE11+)

Default Value:
  • false
Source:

tridentVersion

Properties:
Name Type Description
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:

typedArray

Properties:
Name Type Description
typedArray boolean

Does the browser support TypedArrays?

Default Value:
  • false
Source:

vibration

Properties:
Name Type Description
vibration boolean

Does the device support the Vibration API?

Default Value:
  • false
Source:

wav

Properties:
Name Type Description
wav boolean

Can this device play wav files?

Default Value:
  • false
Source:

webApp

Properties:
Name Type Description
webApp boolean

Set to true if running as a WebApp, i.e. within a WebView

Default Value:
  • false
Source:

webAudio

Properties:
Name Type Description
webAudio boolean

Is the WebAudio API available?

Default Value:
  • false
Source:

webGL

Properties:
Name Type Description
webGL boolean

Is webGL available?

Default Value:
  • false
Source:

webm

Properties:
Name Type Description
webm boolean

Can this device play webm files?

Default Value:
  • false
Source:

windows

Properties:
Name Type Description
windows boolean

Is running on windows?

Default Value:
  • false
Source:

windowsPhone

Properties:
Name Type Description
windowsPhone boolean

Is running on a Windows Phone?

Default Value:
  • false
Source:

worker

Properties:
Name Type Description
worker boolean

Is worker available?

Default Value:
  • false
Source:

Methods

canPlayAudio(type) → {boolean}

Check whether the host environment can play audio.

Parameters:
Name Type Description
type string

One of 'mp3, 'ogg', 'm4a', 'wav', 'webm'.

Source:
Returns:

True if the given file type is supported by the browser, otherwise false.

Type
boolean

checkFullScreenSupport()

Checks for support of the Full Screen API.

Source:

isConsoleOpen() → {boolean}

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:
Returns:

True if the browser dev console is open.

Type
boolean
Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev on Tue Apr 29 2014 14:51:20 GMT+0100 (BST) using the DocStrap template.