How to use Flapjax without the compiler?

11 views
Skip to first unread message

Fred Janon

unread,
Oct 30, 2009, 7:02:56 AM10/30/09
to Flapjax
Hi,

The examples use the compiler, I guess. The paper refers to using the
library without the compiler. so what do I need to use to an HTML page
to use the library only and not anything that deals with the compiler?
I am guessing just include the js library in the HTML head? Do I still
need to use "text/flapjax" around my code or just "text/javascript"
tags? Would the HTML pages then work without any Web connection? Or
does the library still calls home?

Thanks

Fred

Artyom Shalkhakov

unread,
Oct 30, 2009, 7:28:31 AM10/30/09
to fla...@googlegroups.com
Hello Fred,

2009/10/30 Fred Janon <fja...@gmail.com>:


> The examples use the compiler, I guess.

Every example uses the flapjax.js, right. But it's possible and
absolutely okay to use it without the compiler.

> The paper refers to using the
> library without the compiler. so what do I need to use to an HTML page
> to use the library only and not anything that deals with the compiler?
> I am guessing just include the js library in the HTML head? Do I still
> need to use "text/flapjax" around my code or just "text/javascript"
> tags?

You should do something like the following:

<!DOCTYPE html>
<html>
<head>
<title>test page</title>
<script type="text/javascript" src="flapjax.js"></script>
<script type="text/javascript">
function loader() {
// your code goes here
}
</script>
<head>
<body onload="loader()">
<p>hello, world</p>
</body>
</html>

Go to www.flapjax-lang.org/docs/ and see if that makes any sense.

The language in which function contracts are written (e.g.,
EventStream 'a -> Behavior 'a) can seem tricky and unnecessary at
first, but you'll realize its usefulness eventually.

You can also browse the list archives, there are a few demos around.

> Would the HTML pages then work without any Web connection? Or
> does the library still calls home?

Flapjax is geared towards fat clients (i.e., applications that perform
most of their work client-side). But anyway, an answer to your
question very much depends on a specific application.

Cheers,
Artyom Shalkhakov.

Fred Janon

unread,
Oct 30, 2009, 8:12:55 AM10/30/09
to fla...@googlegroups.com
Thanks Artyom for the quick answer. I will check the docs and browse around the archives as you suggested. Thanks for your help.
Very exciting stuff.

Fred

Xingzhi Pan

unread,
Oct 31, 2009, 9:37:12 AM10/31/09
to fla...@googlegroups.com
I always wanted to make this clear when I first read the tutorial. If
my understanding is right, when using Flapjax as a different language,
one can:
1. use {! ... !}
2. use <script type="text/flapjax"> ... </script>
3. use JavaScript functions on events and behaviors without
modification (automatic lifting)

(We can thus see what the compiler actually does, at least partly.)

On the other hand, when Flapjax works as a library of JavaScript, one
just writes JavaScript and must explicitly call functions like liftB
to invoke the magic...

Pan, Xingzhi
http://www.panxingzhi.net

Arjun Guha

unread,
Oct 31, 2009, 12:10:58 PM10/31/09
to fla...@googlegroups.com
> On the other hand, when Flapjax works as a library of JavaScript, one
> just writes JavaScript and must explicitly call functions like liftB
> to invoke the magic...

This is correct.

Arjun

Reply all
Reply to author
Forward
0 new messages