summaryrefslogtreecommitdiffstats
path: root/src/js/templates.js
diff options
context:
space:
mode:
authorHumberto Alfonso Díaz <humberto.alfonso@asvito.es>2019-12-05 12:42:48 +0100
committerLorenzo Tilve <ltilve@igalia.com>2020-02-04 19:20:13 +0100
commit9a25f5f94900b0474b6c5f2fff254a3418ca7f38 (patch)
treee4e252d0f5a7d289fed6db04fca3d32534426ab4 /src/js/templates.js
parent20e04b702f96bf05ff957a8e3c4296d76a2e7656 (diff)
FUNCT Add bootstrap support
Diffstat (limited to 'src/js/templates.js')
-rw-r--r--src/js/templates.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/js/templates.js b/src/js/templates.js
new file mode 100644
index 0000000..2513722
--- /dev/null
+++ b/src/js/templates.js
@@ -0,0 +1,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);
+ }
+ };
+ });
+} \ No newline at end of file