summaryrefslogtreecommitdiffstats
path: root/src/js/templates.js
blob: 2513722b1807cf1513503792ddeb1ed98f7c0d24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
export function load(template) {
    return new Promise(function(resolve, reject){
        var xhr = new XMLHttpRequest();

        xhr.open('GET', '/templates/'+template);
    
        xhr.send();
    
        xhr.onload = function() {
            if (xhr.status != 200) {
                console.error('Error loading template', xhr.status, xhr.statusText);
                reject(xhr.status);
            } else {
                console.log(xhr.responseType);
                resolve(xhr.responseText);
            }
        };
    });
}