We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d50325a commit db5beebCopy full SHA for db5beeb
js/exportGame.js
@@ -1 +1,21 @@
1
+import SceneManager from './sceneManager.js';
2
3
+class ExportGame {
4
+ constructor(sceneManager) {
5
+ this.sceneManager = sceneManager;
6
+ document.getElementById('exportGame').addEventListener('click', () => this.export());
7
+ }
8
+
9
+ export() {
10
+ const gameState = JSON.stringify(this.sceneManager);
11
+ const blob = new Blob([gameState], { type: 'application/json' });
12
+ const url = URL.createObjectURL(blob);
13
+ const a = document.createElement('a');
14
+ a.href = url;
15
+ a.download = 'game.json';
16
+ a.click();
17
+ URL.revokeObjectURL(url);
18
19
+}
20
21
+export default ExportGame;
0 commit comments