sys Class
Module: _decorator Parent Module: cc
System variables
Index
Properties
- LANGUAGE_ENGLISH- StringEnglish language code
- LANGUAGE_CHINESE- StringChinese language code
- LANGUAGE_FRENCH- StringFrench language code
- LANGUAGE_ITALIAN- StringItalian language code
- LANGUAGE_GERMAN- StringGerman language code
- LANGUAGE_SPANISH- StringSpanish language code
- LANGUAGE_DUTCH- StringSpanish language code
- LANGUAGE_RUSSIAN- StringRussian language code
- LANGUAGE_KOREAN- StringKorean language code
- LANGUAGE_JAPANESE- StringJapanese language code
- LANGUAGE_HUNGARIAN- StringHungarian language code
- LANGUAGE_PORTUGUESE- StringPortuguese language code
- LANGUAGE_ARABIC- StringArabic language code
- LANGUAGE_NORWEGIAN- StringNorwegian language code
- LANGUAGE_POLISH- StringPolish language code
- LANGUAGE_TURKISH- StringTurkish language code
- LANGUAGE_UKRAINIAN- StringUkrainian language code
- LANGUAGE_ROMANIAN- StringRomanian language code
- LANGUAGE_BULGARIAN- StringBulgarian language code
- LANGUAGE_UNKNOWN- StringUnknown language code
- OS_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- NumberIndicates whether executes in editor's window process (Electron's renderer context)
- EDITOR_CORE- NumberIndicates whether executes in editor's main process (Electron's browser context)
- WECHAT_GAME- Number
- QQ_PLAY- Number
- FB_PLAYABLE_ADS- Number
- BROWSER_TYPE_WECHAT- StringBROWSER_TYPE_WECHAT
- BROWSER_TYPE_WECHAT_GAME- StringBROWSER_TYPE_WECHAT_GAME
- BROWSER_TYPE_QQ_PLAY- StringBROWSER_TYPE_QQ_PLAY
- BROWSER_TYPE_ANDROID- String
- BROWSER_TYPE_IE- String
- BROWSER_TYPE_QQ- String
- BROWSER_TYPE_MOBILE_QQ- String
- BROWSER_TYPE_UC- String
- BROWSER_TYPE_UCBS- Stringuc 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- BooleanIs native ? This is set to be true in jsb auto.
- isBrowser- BooleanIs web browser ?
- isMobile- BooleanIndicate whether system is mobile system
- platform- NumberIndicate the running platform
- language- StringIndicate the current language of the running system
- os- StringIndicate the running os name
- osVersion- StringIndicate the running os version
- osMainVersion- NumberIndicate the running os main version
- browserType- StringIndicate the running browser type
- browserVersion- StringIndicate the running browser version
- windowPixelResolution- SizeIndicate the real pixel resolution of the whole game window
- localStorage- Objectcc.sys.localStorage is a local storage component.
- capabilities- ObjectThe capabilities of the current platform
Methods
- getBatteryLevelGet the battery level of current device, return 1.0 if failure.
- getNetworkTypeGet the network type of current device, return cc.sys.NetworkType.LAN if failure.
- garbageCollectForces the garbage collection, only available in JSB
- dumpRootDumps rooted objects, only available in JSB
- restartVMRestart the JS VM, only available in JSB
- cleanScriptClean a script in the JS VM, only available in JSB
- isObjectValidIn web engine, it will return true if the object exist
- dumpDump system informations
- openURLOpen a url in browser
- nowGet 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:41 | 
LANGUAGE_CHINESE
Chinese language code
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:48 | 
LANGUAGE_FRENCH
French language code
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:55 | 
LANGUAGE_ITALIAN
Italian language code
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:62 | 
LANGUAGE_GERMAN
German language code
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:69 | 
LANGUAGE_SPANISH
Spanish language code
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:76 | 
LANGUAGE_DUTCH
Spanish language code
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:83 | 
LANGUAGE_RUSSIAN
Russian language code
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:90 | 
LANGUAGE_KOREAN
Korean language code
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:97 | 
LANGUAGE_JAPANESE
Japanese language code
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:104 | 
LANGUAGE_HUNGARIAN
Hungarian language code
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:111 | 
LANGUAGE_PORTUGUESE
Portuguese language code
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:118 | 
LANGUAGE_ARABIC
Arabic language code
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:125 | 
LANGUAGE_NORWEGIAN
Norwegian language code
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:132 | 
LANGUAGE_POLISH
Polish language code
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:139 | 
LANGUAGE_TURKISH
Turkish language code
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:146 | 
LANGUAGE_UKRAINIAN
Ukrainian language code
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:153 | 
LANGUAGE_ROMANIAN
Romanian language code
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:160 | 
LANGUAGE_BULGARIAN
Bulgarian language code
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:167 | 
LANGUAGE_UNKNOWN
Unknown language code
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:174 | 
OS_IOS
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:181 | 
OS_ANDROID
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:186 | 
OS_WINDOWS
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:191 | 
OS_MARMALADE
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:196 | 
OS_LINUX
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:201 | 
OS_BADA
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:206 | 
OS_BLACKBERRY
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:211 | 
OS_OSX
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:216 | 
OS_WP8
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:221 | 
OS_WINRT
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:226 | 
OS_UNKNOWN
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:231 | 
UNKNOWN
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | cocos2d/core/platform/CCSys.js:237 | 
WIN32
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | cocos2d/core/platform/CCSys.js:243 | 
LINUX
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | cocos2d/core/platform/CCSys.js:249 | 
MACOS
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | cocos2d/core/platform/CCSys.js:255 | 
ANDROID
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | cocos2d/core/platform/CCSys.js:261 | 
IPHONE
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | cocos2d/core/platform/CCSys.js:267 | 
IPAD
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | cocos2d/core/platform/CCSys.js:273 | 
BLACKBERRY
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | cocos2d/core/platform/CCSys.js:279 | 
NACL
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | cocos2d/core/platform/CCSys.js:285 | 
EMSCRIPTEN
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | cocos2d/core/platform/CCSys.js:291 | 
TIZEN
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | cocos2d/core/platform/CCSys.js:297 | 
WINRT
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | cocos2d/core/platform/CCSys.js:303 | 
WP8
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | cocos2d/core/platform/CCSys.js:309 | 
MOBILE_BROWSER
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | cocos2d/core/platform/CCSys.js:315 | 
DESKTOP_BROWSER
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | cocos2d/core/platform/CCSys.js:321 | 
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:328 | 
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:335 | 
WECHAT_GAME
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | cocos2d/core/platform/CCSys.js:342 | 
QQ_PLAY
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | cocos2d/core/platform/CCSys.js:348 | 
FB_PLAYABLE_ADS
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | cocos2d/core/platform/CCSys.js:354 | 
BROWSER_TYPE_WECHAT
BROWSER_TYPE_WECHAT
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:361 | 
BROWSER_TYPE_WECHAT_GAME
BROWSER_TYPE_WECHAT_GAME
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:368 | 
BROWSER_TYPE_QQ_PLAY
BROWSER_TYPE_QQ_PLAY
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:377 | 
BROWSER_TYPE_ANDROID
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:384 | 
BROWSER_TYPE_IE
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:391 | 
BROWSER_TYPE_QQ
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:398 | 
BROWSER_TYPE_MOBILE_QQ
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:405 | 
BROWSER_TYPE_UC
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:412 | 
BROWSER_TYPE_UCBS
uc third party integration.
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:419 | 
BROWSER_TYPE_360
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:426 | 
BROWSER_TYPE_BAIDU_APP
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:433 | 
BROWSER_TYPE_BAIDU
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:440 | 
BROWSER_TYPE_MAXTHON
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:447 | 
BROWSER_TYPE_OPERA
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:454 | 
BROWSER_TYPE_OUPENG
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:461 | 
BROWSER_TYPE_MIUI
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:468 | 
BROWSER_TYPE_FIREFOX
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:475 | 
BROWSER_TYPE_SAFARI
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:482 | 
BROWSER_TYPE_CHROME
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:489 | 
BROWSER_TYPE_LIEBAO
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:496 | 
BROWSER_TYPE_QZONE
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:503 | 
BROWSER_TYPE_SOUGOU
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:510 | 
BROWSER_TYPE_UNKNOWN
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:517 | 
isNative
Is native ? This is set to be true in jsb auto.
| meta | description | 
|---|---|
| Type | Boolean | 
| Defined in | cocos2d/core/platform/CCSys.js:596 | 
isBrowser
Is web browser ?
| meta | description | 
|---|---|
| Type | Boolean | 
| Defined in | cocos2d/core/platform/CCSys.js:602 | 
isMobile
Indicate whether system is mobile system
| meta | description | 
|---|---|
| Type | Boolean | 
| Defined in | cocos2d/core/platform/CCSys.js:753 | 
platform
Indicate the running platform
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | cocos2d/core/platform/CCSys.js:759 | 
language
Indicate the current language of the running system
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:775 | 
os
Indicate the running os name
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:808 | 
osVersion
Indicate the running os version
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:813 | 
osMainVersion
Indicate the running os main version
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | cocos2d/core/platform/CCSys.js:818 | 
browserType
Indicate the running browser type
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:824 | 
browserVersion
Indicate the running browser version
| meta | description | 
|---|---|
| Type | String | 
| Defined in | cocos2d/core/platform/CCSys.js:862 | 
windowPixelResolution
Indicate the real pixel resolution of the whole game window
| meta | description | 
|---|---|
| Type | Size | 
| Defined in | cocos2d/core/platform/CCSys.js:880 | 
localStorage
cc.sys.localStorage is a local storage component.
| meta | description | 
|---|---|
| Type | Object | 
| Defined in | cocos2d/core/platform/CCSys.js:928 | 
capabilities
The capabilities of the current platform
| meta | description | 
|---|---|
| Type | Object | 
| Defined in | cocos2d/core/platform/CCSys.js:997 | 
Methods
getBatteryLevel
Get the battery level of current device, return 1.0 if failure.
| meta | description | 
|---|---|
| Returns | Number | 
| Defined in | cocos2d/core/platform/CCSys.js:567 | 
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:581 | 
garbageCollect
Forces the garbage collection, only available in JSB
| meta | description | 
|---|---|
| Defined in | cocos2d/core/platform/CCSys.js:1104 | 
dumpRoot
Dumps rooted objects, only available in JSB
| meta | description | 
|---|---|
| Defined in | cocos2d/core/platform/CCSys.js:1112 | 
restartVM
Restart the JS VM, only available in JSB
| meta | description | 
|---|---|
| Defined in | cocos2d/core/platform/CCSys.js:1120 | 
cleanScript
Clean a script in the JS VM, only available in JSB
| meta | description | 
|---|---|
| Defined in | cocos2d/core/platform/CCSys.js:1128 | 
Parameters
- jsfileString
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:1137 | 
Parameters
- objObject
dump
Dump system informations
| meta | description | 
|---|---|
| Defined in | cocos2d/core/platform/CCSys.js:1150 | 
openURL
Open a url in browser
| meta | description | 
|---|---|
| Defined in | cocos2d/core/platform/CCSys.js:1169 | 
Parameters
- urlString
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:1178 | 
