-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
30 lines (25 loc) · 912 Bytes
/
index.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
import { Elm } from './src/Main.elm';
function blastoff () {
Sentry && Sentry.init({
dsn: 'https://[email protected]/1777628',
environment: process.env.NODE_ENV
});
var app = Elm.Main.init({
// node: document.getElementById('main'),
flags: {
env: process.env.NODE_ENV, // magic compile-time constant from Parcel; not a real variable!
}
});
app.ports.log && app.ports.log.subscribe(function(data) {
console[data.level || 'error']('log', data);
Sentry && Sentry.captureException(new Error(JSON.stringify(data)));
});
app.ports.setPath && app.ports.setPath.subscribe(function(p) {
var path = '/' + p;
console.log('setting path to', path)
history.pushState({}, "", path);
localStorage.setItem('key', path);
});
Sentry && Sentry.captureMessage("load", "debug");
}
window.addEventListener('DOMContentLoaded', blastoff);