Skip to content

Commit fa68c45

Browse files
committed
Merge pull request #2485 from pandamicro/develop
#1108: Add restartGame and cleanScript API for web
2 parents d71d139 + b6807f9 commit fa68c45

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

CCBoot.js

+10-6
Original file line numberDiff line numberDiff line change
@@ -1645,7 +1645,7 @@ cc._initSys = function (config, CONFIG_KEY) {
16451645
capabilities["accelerometer"] = true;
16461646

16471647
/**
1648-
* Forces the garbage collection
1648+
* Forces the garbage collection, only available in JSB
16491649
* @memberof cc.sys
16501650
* @name garbageCollect
16511651
* @function
@@ -1655,7 +1655,7 @@ cc._initSys = function (config, CONFIG_KEY) {
16551655
};
16561656

16571657
/**
1658-
* Dumps rooted objects
1658+
* Dumps rooted objects, only available in JSB
16591659
* @memberof cc.sys
16601660
* @name dumpRoot
16611661
* @function
@@ -1665,7 +1665,7 @@ cc._initSys = function (config, CONFIG_KEY) {
16651665
};
16661666

16671667
/**
1668-
* Restart the JS VM
1668+
* Restart the JS VM, only available in JSB
16691669
* @memberof cc.sys
16701670
* @name restartVM
16711671
* @function
@@ -1675,7 +1675,7 @@ cc._initSys = function (config, CONFIG_KEY) {
16751675
};
16761676

16771677
/**
1678-
* cleanScript the singal JS file
1678+
* Clean a script in the JS VM, only available in JSB
16791679
* @memberof cc.sys
16801680
* @name cleanScript
16811681
* @param {String} jsfile
@@ -2047,10 +2047,14 @@ cc.game = /** @lends cc.game# */{
20472047
},
20482048

20492049
/**
2050-
* Run game.
2050+
* Restart game.
20512051
*/
20522052
restart: function () {
2053-
//window.location.href = window.location.href;
2053+
cc.director.popToSceneStackLevel(0);
2054+
// Clean up audio
2055+
cc.audioEngine.end();
2056+
2057+
cc.game.onStart();
20542058
},
20552059

20562060
/**

0 commit comments

Comments
 (0)