sys
Class
Module: _decorator Parent Module: cc
System variables
Index
Properties
LANGUAGE_ENGLISH
String
English language codeLANGUAGE_CHINESE
String
Chinese language codeLANGUAGE_FRENCH
String
French language codeLANGUAGE_ITALIAN
String
Italian language codeLANGUAGE_GERMAN
String
German language codeLANGUAGE_SPANISH
String
Spanish language codeLANGUAGE_DUTCH
String
Spanish language codeLANGUAGE_RUSSIAN
String
Russian language codeLANGUAGE_KOREAN
String
Korean language codeLANGUAGE_JAPANESE
String
Japanese language codeLANGUAGE_HUNGARIAN
String
Hungarian language codeLANGUAGE_PORTUGUESE
String
Portuguese language codeLANGUAGE_ARABIC
String
Arabic language codeLANGUAGE_NORWEGIAN
String
Norwegian language codeLANGUAGE_POLISH
String
Polish language codeLANGUAGE_TURKISH
String
Turkish language codeLANGUAGE_UKRAINIAN
String
Ukrainian language codeLANGUAGE_ROMANIAN
String
Romanian language codeLANGUAGE_BULGARIAN
String
Bulgarian language codeLANGUAGE_UNKNOWN
String
Unknown language codeOS_IOS
String
OS_ANDROID
String
OS_WINDOWS
String
OS_MARMALADE
String
OS_LINUX
String
OS_BADA
String
OS_BLACKBERRY
String
OS_OSX
String
OS_WP8
String
OS_WINRT
String
OS_UNKNOWN
String
UNKNOWN
Number
WIN32
Number
LINUX
Number
MACOS
Number
ANDROID
Number
IPHONE
Number
IPAD
Number
BLACKBERRY
Number
NACL
Number
EMSCRIPTEN
Number
TIZEN
Number
WINRT
Number
WP8
Number
MOBILE_BROWSER
Number
DESKTOP_BROWSER
Number
EDITOR_PAGE
Number
Indicates whether executes in editor's window process (Electron's renderer context)EDITOR_CORE
Number
Indicates whether executes in editor's main process (Electron's browser context)WECHAT_GAME
Number
QQ_PLAY
Number
FB_PLAYABLE_ADS
Number
BAIDU_GAME
Number
VIVO_GAME
Number
OPPO_GAME
Number
HUAWEI_GAME
Number
XIAOMI_GAME
Number
JKW_GAME
Number
ALIPAY_GAME
Number
WECHAT_GAME_SUB
Number
BAIDU_GAME_SUB
Number
BROWSER_TYPE_WECHAT
String
BROWSER_TYPE_WECHATBROWSER_TYPE_WECHAT_GAME
String
BROWSER_TYPE_WECHAT_GAMEBROWSER_TYPE_WECHAT_GAME_SUB
String
BROWSER_TYPE_WECHAT_GAME_SUBBROWSER_TYPE_BAIDU_GAME
String
BROWSER_TYPE_BAIDU_GAMEBROWSER_TYPE_BAIDU_GAME_SUB
String
BROWSER_TYPE_BAIDU_GAME_SUBBROWSER_TYPE_XIAOMI_GAME
String
BROWSER_TYPE_XIAOMI_GAMEBROWSER_TYPE_ALIPAY_GAME
String
BROWSER_TYPE_ALIPAY_GAMEBROWSER_TYPE_QQ_PLAY
String
BROWSER_TYPE_QQ_PLAYBROWSER_TYPE_ANDROID
String
BROWSER_TYPE_IE
String
BROWSER_TYPE_EDGE
String
BROWSER_TYPE_QQ
String
BROWSER_TYPE_MOBILE_QQ
String
BROWSER_TYPE_UC
String
BROWSER_TYPE_UCBS
String
uc third party integration.BROWSER_TYPE_360
String
BROWSER_TYPE_BAIDU_APP
String
BROWSER_TYPE_BAIDU
String
BROWSER_TYPE_MAXTHON
String
BROWSER_TYPE_OPERA
String
BROWSER_TYPE_OUPENG
String
BROWSER_TYPE_MIUI
String
BROWSER_TYPE_FIREFOX
String
BROWSER_TYPE_SAFARI
String
BROWSER_TYPE_CHROME
String
BROWSER_TYPE_LIEBAO
String
BROWSER_TYPE_QZONE
String
BROWSER_TYPE_SOUGOU
String
BROWSER_TYPE_UNKNOWN
String
isNative
Boolean
Is native ? This is set to be true in jsb auto.isBrowser
Boolean
Is web browser ?isMobile
Boolean
Indicate whether system is mobile systemplatform
Number
Indicate the running platformlanguageCode
String
Get current language iso 639-1 code.language
String
Indicate the current language of the running systemos
String
Indicate the running os nameosVersion
String
Indicate the running os versionosMainVersion
Number
Indicate the running os main versionbrowserType
String
Indicate the running browser typebrowserVersion
String
Indicate the running browser versionwindowPixelResolution
Size
Indicate the real pixel resolution of the whole game windowlocalStorage
Object
cc.sys.localStorage is a local storage component.capabilities
Object
The capabilities of the current platform
Methods
glExtension
Is webgl extension support?getMaxJointMatrixSize
Get max joint matrix size for skinned mesh renderer.getNetworkType
Get the network type of current device, return cc.sys.NetworkType.LAN if failure.getBatteryLevel
Get the battery level of current device, return 1.0 if failure.garbageCollect
Forces the garbage collection, only available in JSBrestartVM
Restart the JS VM, only available in JSBgetSafeAreaRect
Return the safe area rect.isObjectValid
In web engine, it will return true if the object existdump
Dump system informationsopenURL
Open a url in browsernow
Get the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.
Details
Properties
LANGUAGE_ENGLISH
English language code
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:51 |
LANGUAGE_CHINESE
Chinese language code
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:58 |
LANGUAGE_FRENCH
French language code
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:65 |
LANGUAGE_ITALIAN
Italian language code
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:72 |
LANGUAGE_GERMAN
German language code
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:79 |
LANGUAGE_SPANISH
Spanish language code
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:86 |
LANGUAGE_DUTCH
Spanish language code
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:93 |
LANGUAGE_RUSSIAN
Russian language code
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:100 |
LANGUAGE_KOREAN
Korean language code
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:107 |
LANGUAGE_JAPANESE
Japanese language code
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:114 |
LANGUAGE_HUNGARIAN
Hungarian language code
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:121 |
LANGUAGE_PORTUGUESE
Portuguese language code
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:128 |
LANGUAGE_ARABIC
Arabic language code
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:135 |
LANGUAGE_NORWEGIAN
Norwegian language code
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:142 |
LANGUAGE_POLISH
Polish language code
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:149 |
LANGUAGE_TURKISH
Turkish language code
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:156 |
LANGUAGE_UKRAINIAN
Ukrainian language code
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:163 |
LANGUAGE_ROMANIAN
Romanian language code
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:170 |
LANGUAGE_BULGARIAN
Bulgarian language code
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:177 |
LANGUAGE_UNKNOWN
Unknown language code
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:184 |
OS_IOS
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:191 |
OS_ANDROID
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:196 |
OS_WINDOWS
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:201 |
OS_MARMALADE
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:206 |
OS_LINUX
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:211 |
OS_BADA
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:216 |
OS_BLACKBERRY
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:221 |
OS_OSX
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:226 |
OS_WP8
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:231 |
OS_WINRT
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:236 |
OS_UNKNOWN
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:241 |
UNKNOWN
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:247 |
WIN32
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:253 |
LINUX
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:259 |
MACOS
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:265 |
ANDROID
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:271 |
IPHONE
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:277 |
IPAD
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:283 |
BLACKBERRY
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:289 |
NACL
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:295 |
EMSCRIPTEN
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:301 |
TIZEN
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:307 |
WINRT
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:313 |
WP8
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:319 |
MOBILE_BROWSER
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:325 |
DESKTOP_BROWSER
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:331 |
EDITOR_PAGE
Indicates whether executes in editor's window process (Electron's renderer context)
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:338 |
EDITOR_CORE
Indicates whether executes in editor's main process (Electron's browser context)
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:345 |
WECHAT_GAME
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:352 |
QQ_PLAY
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:358 |
FB_PLAYABLE_ADS
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:364 |
BAIDU_GAME
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:370 |
VIVO_GAME
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:376 |
OPPO_GAME
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:382 |
HUAWEI_GAME
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:388 |
XIAOMI_GAME
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:394 |
JKW_GAME
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:400 |
ALIPAY_GAME
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:406 |
WECHAT_GAME_SUB
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:412 |
BAIDU_GAME_SUB
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:418 |
BROWSER_TYPE_WECHAT
BROWSER_TYPE_WECHAT
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:424 |
BROWSER_TYPE_WECHAT_GAME
BROWSER_TYPE_WECHAT_GAME
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:431 |
BROWSER_TYPE_WECHAT_GAME_SUB
BROWSER_TYPE_WECHAT_GAME_SUB
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:438 |
BROWSER_TYPE_BAIDU_GAME
BROWSER_TYPE_BAIDU_GAME
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:445 |
BROWSER_TYPE_BAIDU_GAME_SUB
BROWSER_TYPE_BAIDU_GAME_SUB
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:452 |
BROWSER_TYPE_XIAOMI_GAME
BROWSER_TYPE_XIAOMI_GAME
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:459 |
BROWSER_TYPE_ALIPAY_GAME
BROWSER_TYPE_ALIPAY_GAME
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:466 |
BROWSER_TYPE_QQ_PLAY
BROWSER_TYPE_QQ_PLAY
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:473 |
BROWSER_TYPE_ANDROID
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:480 |
BROWSER_TYPE_IE
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:487 |
BROWSER_TYPE_EDGE
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:494 |
BROWSER_TYPE_QQ
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:501 |
BROWSER_TYPE_MOBILE_QQ
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:508 |
BROWSER_TYPE_UC
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:515 |
BROWSER_TYPE_UCBS
uc third party integration.
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:522 |
BROWSER_TYPE_360
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:529 |
BROWSER_TYPE_BAIDU_APP
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:536 |
BROWSER_TYPE_BAIDU
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:543 |
BROWSER_TYPE_MAXTHON
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:550 |
BROWSER_TYPE_OPERA
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:557 |
BROWSER_TYPE_OUPENG
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:564 |
BROWSER_TYPE_MIUI
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:571 |
BROWSER_TYPE_FIREFOX
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:578 |
BROWSER_TYPE_SAFARI
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:585 |
BROWSER_TYPE_CHROME
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:592 |
BROWSER_TYPE_LIEBAO
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:599 |
BROWSER_TYPE_QZONE
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:606 |
BROWSER_TYPE_SOUGOU
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:613 |
BROWSER_TYPE_UNKNOWN
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:620 |
isNative
Is native ? This is set to be true in jsb auto.
meta | description |
---|---|
Type | Boolean |
Defined in | cocos2d/core/platform/CCSys.js:628 |
isBrowser
Is web browser ?
meta | description |
---|---|
Type | Boolean |
Defined in | cocos2d/core/platform/CCSys.js:635 |
isMobile
Indicate whether system is mobile system
meta | description |
---|---|
Type | Boolean |
Defined in | cocos2d/core/platform/CCSys.js:776 |
platform
Indicate the running platform
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:782 |
languageCode
Get current language iso 639-1 code. Examples of valid language codes include "zh-tw", "en", "en-us", "fr", "fr-fr", "es-es", etc. The actual value totally depends on results provided by destination platform.
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:797 |
language
Indicate the current language of the running system
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:807 |
os
Indicate the running os name
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:846 |
osVersion
Indicate the running os version
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:851 |
osMainVersion
Indicate the running os main version
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCSys.js:856 |
browserType
Indicate the running browser type
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:862 |
browserVersion
Indicate the running browser version
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/platform/CCSys.js:893 |
windowPixelResolution
Indicate the real pixel resolution of the whole game window
meta | description |
---|---|
Type | Size |
Defined in | cocos2d/core/platform/CCSys.js:911 |
localStorage
cc.sys.localStorage is a local storage component.
meta | description |
---|---|
Type | Object |
Defined in | cocos2d/core/platform/CCSys.js:944 |
capabilities
The capabilities of the current platform
meta | description |
---|---|
Type | Object |
Defined in | cocos2d/core/platform/CCSys.js:975 |
Methods
glExtension
Is webgl extension support?
meta | description |
---|---|
Defined in | cocos2d/core/platform/CCSys.js:641 |
Parameters
name
Unknown
getMaxJointMatrixSize
Get max joint matrix size for skinned mesh renderer.
meta | description |
---|---|
Defined in | cocos2d/core/platform/CCSys.js:650 |
getNetworkType
Get the network type of current device, return cc.sys.NetworkType.LAN if failure.
meta | description |
---|---|
Returns | NetworkType |
Defined in | cocos2d/core/platform/CCSys.js:1125 |
getBatteryLevel
Get the battery level of current device, return 1.0 if failure.
meta | description |
---|---|
Returns | Number |
Defined in | cocos2d/core/platform/CCSys.js:1139 |
garbageCollect
Forces the garbage collection, only available in JSB
meta | description |
---|---|
Defined in | cocos2d/core/platform/CCSys.js:1153 |
restartVM
Restart the JS VM, only available in JSB
meta | description |
---|---|
Defined in | cocos2d/core/platform/CCSys.js:1161 |
getSafeAreaRect
Return the safe area rect.
only available on the iOS native platform, otherwise it will return a rect with design resolution size.
meta | description |
---|---|
Returns | Rect |
Defined in | cocos2d/core/platform/CCSys.js:1169 |
isObjectValid
Check whether an object is valid, In web engine, it will return true if the object exist In native engine, it will return true if the JS object and the correspond native object are both valid
meta | description |
---|---|
Returns | Boolean |
Defined in | cocos2d/core/platform/CCSys.js:1183 |
Parameters
obj
Object
dump
Dump system informations
meta | description |
---|---|
Defined in | cocos2d/core/platform/CCSys.js:1198 |
openURL
Open a url in browser
meta | description |
---|---|
Defined in | cocos2d/core/platform/CCSys.js:1217 |
Parameters
url
String
now
Get the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.
meta | description |
---|---|
Returns | Number |
Defined in | cocos2d/core/platform/CCSys.js:1231 |