summaryrefslogtreecommitdiff
path: root/src/UI.js
blob: a6dd0fa5f8864d0cff05dbbddda344fd585f98d9 (plain)
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
export const _cheatLog = (a) => () => console.log(a);
export const _setInterval = (delay) => (f) => () => setInterval(f, delay);
export const _toJSON = (x) => JSON.stringify(x);

export const _reload = () => {
    window.location.reload();
};

export const _redirect = (url) => () => {
    window.location.href = url;
};

export const _submitRedeem = (url) => (el) => () => {
    const redeem = el.children[0].textContent;
    const inp = el.children[1]?.value;
    console.log(redeem, inp);
    const data = new FormData();
    data.append("name", redeem);
    data.append("input", inp);
    fetch(url, {
        method: "post",
        body: data,
    });
};

export const _setShader = (shader) => () => {
    window.wasmBindings.set_shader(shader);
};