MCPcopy
hub / github.com/victorqribeiro/isocity / updateHashState

Function updateHashState

js/main.js:88–101  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

86}
87
88const updateHashState = () => {
89 let c = 0
90 const u8 = new Uint8Array(ntiles * ntiles)
91 for (let i = 0; i < ntiles; i++) {
92 for (let j = 0; j < ntiles; j++) {
93 u8[c++] = map[i][j][0] * texWidth + map[i][j][1]
94 }
95 }
96 const state = ToBase64(u8)
97 if (!previousState || previousState != state) {
98 history.pushState(undefined, undefined, `#${state}`)
99 previousState = state
100 }
101}
102
103window.addEventListener('popstate', function () {
104 loadHashState(document.location.hash.substring(1))

Callers 1

clickFunction · 0.85

Calls 1

ToBase64Function · 0.85

Tested by

no test coverage detected