-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Maximilian Berkmann edited this page Oct 5, 2016
·
9 revisions
Welcome to the EssenceJS wiki!
To use EssenceJS locally (with all the required modules installed), you need to have at least the following structure in your code:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="path/to/essence.js"></script>
<script type="text/javascript" defer>
function Init (stackLayer) {
if (typeof Essence !== "undefined") {
//Your code for when the browser is ready to use your EssenceJS code
} else if (stackLayer > 3) {
console.log("Wow, hold on ! %d stack layers down !!", stackLayer);
setTimeout("Init()", 5);
} else {
console.warn("EssenceJS is not currently available !");
Init(stackLayer? stackLayer + 1: 1);
}
}
</script>
</head>
<body onpageshow="Init()">
</body>
</html>
index.html (the name doesn't matter)
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="path/to/essence.js"></script>
<script type="text/javascript" src="path/to/yourscript.js"></script>
</head>
<body onpageshow="Init()">
</body>
</html>
yourscript.js
function Init (stackLayer) {
if (typeof Essence !== "undefined") {
//Your code for when the browser is ready to use your EssenceJS code
} else if (stackLayer > 3) {
console.log("Wow, hold on ! %d stack layers down !!", stackLayer);
setTimeout("Init()", 5);
} else {
console.warn("EssenceJS is not currently available !");
Init(stackLayer? stackLayer + 1: 1);
}
}
To use EssenceJS with an internet access and (without downloading anything), you need to have at least the following structure in your code:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://berkmann18.github.io/rsc/essence.js"></script>
<script type="text/javascript" defer>
function Init (stackLayer) {
if (typeof Essence !== "undefined") {
//Your code for when the browser is ready to use your EssenceJS code
} else if (stackLayer > 3) {
console.log("Wow, hold on ! %d stack layers down !!", stackLayer);
setTimeout("Init()", 5);
} else {
console.warn("EssenceJS is not currently available !");
Init(stackLayer? stackLayer + 1: 1);
}
}
</script>
</head>
<body onpageshow="Init()">
</body>
</html>
index.html
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://berkmann18.github.io/rsc/essence.js"></script>
<script type="text/javascript" src="path/to/yourscript.js"></script>
</head>
<body onpageshow="Init()">
</body>
</html>
yourscript.js
function Init (stackLayer) {
if (typeof Essence !== "undefined") {
//Your code for when the browser is ready to use your EssenceJS code
} else if (stackLayer > 3) {
console.log("Wow, hold on ! %d stack layers down !!", stackLayer);
setTimeout("Init()", 5);
} else {
console.warn("EssenceJS is not currently available !");
Init(stackLayer? stackLayer + 1: 1);
}
}