razjs
Advanced tools
Comparing version 1.1.1 to 1.1.2
{ | ||
"name": "razjs", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "JS-version of the Razor-Express library (Razor-like template engine for NodeJS Express).", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -101,17 +101,12 @@ # RazJS | ||
window.addEventListener('error', function (e) { | ||
if (!e.error.isRazorError) return; | ||
setTimeout(() => { | ||
// The document have to be fully loaded before replacing its whole content - that's why we use timer. | ||
document.documentElement.innerHTML = e.error.html(); | ||
}, 0); | ||
e.preventDefault(); // Stop propagating since we've handled it. | ||
}); | ||
setTimeout(() => { | ||
// The document have to be fully loaded before replacing its whole content - that's why we use timer. | ||
document.documentElement.innerHTML = (e.error.isRazorError) ? e.error.html() : e.error.toString(); | ||
}, 0); | ||
e.preventDefault(); // Stop propagating since we've handled it. | ||
}); | ||
const num = 1; | ||
const template = ` | ||
<div> | ||
@Model | ||
</span>`; | ||
const html = raz.render(template, num); | ||
const model = 1; | ||
const template = "<span>@Model</span>"; | ||
const html = raz.render(template, model); | ||
document.getElementById("target").innerHTML = html; | ||
@@ -118,0 +113,0 @@ |
101948
195