Skip to content

#1108: Add restartGame and cleanScript API for web #2485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 4, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions CCBoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -1645,7 +1645,7 @@ cc._initSys = function (config, CONFIG_KEY) {
capabilities["accelerometer"] = true;

/**
* Forces the garbage collection
* Forces the garbage collection, only available in JSB
* @memberof cc.sys
* @name garbageCollect
* @function
Expand All @@ -1655,7 +1655,7 @@ cc._initSys = function (config, CONFIG_KEY) {
};

/**
* Dumps rooted objects
* Dumps rooted objects, only available in JSB
* @memberof cc.sys
* @name dumpRoot
* @function
Expand All @@ -1665,7 +1665,7 @@ cc._initSys = function (config, CONFIG_KEY) {
};

/**
* Restart the JS VM
* Restart the JS VM, only available in JSB
* @memberof cc.sys
* @name restartVM
* @function
Expand All @@ -1675,7 +1675,7 @@ cc._initSys = function (config, CONFIG_KEY) {
};

/**
* cleanScript the singal JS file
* Clean a script in the JS VM, only available in JSB
* @memberof cc.sys
* @name cleanScript
* @param {String} jsfile
Expand Down Expand Up @@ -2047,10 +2047,14 @@ cc.game = /** @lends cc.game# */{
},

/**
* Run game.
* Restart game.
*/
restart: function () {
//window.location.href = window.location.href;
cc.director.popToSceneStackLevel(0);
// Clean up audio
cc.audioEngine.end();

cc.game.onStart();
},

/**
Expand Down