Skip to content

Flags

Flags provide a way to get values from javascript when your application starts.

To start using flags, you’ll need a program defined with Browser.element, Browser.document, or Browser.application.

Then compile your program to a javascript file:

Terminal window
gren make src/Main.gren --output=main.js

And create an html file that starts your program like this:

<html>
<head>
<script src="main.js"></script>
</head>
<body>
<div id="myapp"></div>
<script>
var app = Gren.Main.init({
node: document.getElementById('myapp'),
flags: Date.now()
});
</script>
</body>
</html>

In this example, the current date will be passed as the first parameter to your program’s init function.