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:

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:

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:

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:

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.

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:

patchAndroidClearRectBug

An optional 'fix' for the horrendous Android stock browser bug https://code.google.com/p/android/issues/detail?id=39247

Properties:
Name Type Description
patchAndroidClearRectBug boolean

Description.

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:

safari

Properties:
Name Type Description
safari boolean

Set to true if running in Safari.

Default Value:
  • false
Source:

touch

Properties:
Name Type Description
touch boolean

Is touch available?

Default Value:
  • false
Source:

typedArray

Properties:
Name Type Description
typedArray boolean

Does the browser support TypedArrays?

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:

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

isConsoleOpen() → {boolean}

Check whether the console is open.

Source:
Returns:

True if the browser dev console is open.

Type
boolean
Phaser Copyright © 2012-2013 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev on Thu Nov 28 2013 15:56:27 GMT-0000 (GMT) using the DocStrap template.