forked from hackclub/sprig
-
Notifications
You must be signed in to change notification settings - Fork 0
/
global_state.js
35 lines (32 loc) · 953 Bytes
/
global_state.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { palette } from "./palette.js"
const githubPages = str => `https://hackclub.github.io/sprig/games/${str}.js`;
const makeSampleLink = str =>
`${window.location.protocol}//${window.location.host}/?file=${githubPages(str)}`
const makeSample = str => ({
name: str,
link: makeSampleLink(str)
})
export const global_state = {
codemirror: undefined,
errorInfo: null,
logs: [],
// notifications: [],
editor: null,
editRange: null,
samples: [
// makeSample("test"),
makeSample("maze"),
makeSample("pyre"),
// makeSample("flightless_bird"),
makeSample("laser-tag")
],
bitmaps: [],
savedGames: [],
palette,
staleRun: true,
shareLinkState: 'idle', // idle, loading, copied
uploadState: 'idle', // idle, uploading, done
uploadLogs: '',
newDocument: false, // Whether the editor just loaded a new game, to avoid triggering a save
prevName: null, // The name of the game when it was last saved
}