-
-
Save si14/7229a3b39bb2ac603523 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% -*- mode: nitrogen -*- | |
-module (test). | |
-compile(export_all). | |
-include_lib("nitrogen_core/include/wf.hrl"). | |
-include("records.hrl"). | |
main() -> #template { file="./site/templates/bare.html" }. | |
title() -> "Hello from test.erl!". | |
body() -> | |
wf:comet(fun() -> counter(1) end), | |
[ | |
#panel { style="margin: 50px 100px;", body=[ | |
#span { text="Hello from test.erl!" }, | |
#p{}, | |
#button { text="Click me!", postback=click }, | |
#p{}, | |
#panel { id=placeholder } | |
]} | |
]. | |
event(click) -> | |
wf:insert_top(placeholder, "<p>You clicked the button!!"). | |
counter(Count) -> | |
?PRINT(Count), | |
timer:sleep(1000), | |
wf:insert_bottom(p_messages, integer_to_list(Count) ++ "<br>"), | |
wf:flush(), | |
counter(Count + 1). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment