]> git.r.bdr.sh - rbdr/heart/blame - js/app.js
Remove unnecessary files
[rbdr/heart] / js / app.js
CommitLineData
910278aa
BB
1'use strict';
2
3// Sets up the application
4
5((window) => {
6
7 const internals = {};
8
9 internals.onLoad = () => {
10
11 const mainElement = window.document.getElementById('heart-app-entry-point');
12 const heartRenderer = new HeartRenderer();
13
14 heartRenderer.render(mainElement);
15 heartRenderer.activate();
16
f895bdac 17 window.addEventListener('resize', heartRenderer.resize.bind(heartRenderer));
eb188a5e
BB
18 window.addEventListener('blur', heartRenderer.stopFollowingMouse.bind(heartRenderer));
19 window.addEventListener('focus', heartRenderer.startFollowingMouse.bind(heartRenderer));
f895bdac 20
910278aa
BB
21 /**
22 * Exported global object. This will contain the instance of the heart
23 * renderer being used. It is set up on load.
24 *
25 * @name App
26 * @type Object
27 * @property {HeartRenderer} heartRenderer The instance of the heart renderer being used.
28 */
29 window.App = {
30 heartRenderer
31 };
32 };
33
34 window.addEventListener('load', internals.onLoad);
35})(window);