Cleaning up code
You've fully released Toggle Runner's "Space Mode" and there are no users still seeing the old dinosaur version. This means that the space-mode
flag is no longer needed, and can be removed from the code.
The simplest way of changing the drawGame
function is to remove the if
statement which evaluates the flag, but keep the five lines of code within. Note that you'll need to change the indentation of those five lines to match the last line.
The remaining code will look like this:
function drawGame() {
// Change the source URL used for the sprite sheets
smallSprites.src = "/images/100-percent/100-sprite-space.png";
largeSprites.src = "/images/200-percent/200-sprite-space.png";
// Change the game name heading
heading.innerText = "Toggle Runner";
const runner = new Runner('.interstitial-wrapper', config);
}
There's also the listener which redraws the game in response to the space-mode
flag changing. It's the block that looks like this:
ldclient.on('change:space-mode', function (currentValue, previousValue) {
// [... several lines of code...]
Runner.instance_.updateGraphics();
});
Since that flag is going away, so can the listener. You can delete that entire block.
In the next step, you'll archive the flag so that it no longer appears on the dashboard.