Skip to content

Instantly share code, notes, and snippets.

@t0yv0
Created December 30, 2011 17:23
Show Gist options
  • Save t0yv0/1540678 to your computer and use it in GitHub Desktop.
Save t0yv0/1540678 to your computer and use it in GitHub Desktop.
namespace Website
module Client =
open IntelliFactory.WebSharper
open IntelliFactory.WebSharper.Html
[<JavaScript>]
let SayHello () =
JavaScript.Alert("HELLO!")
[<JavaScript>]
let MakeHelloDiv () =
SayHello ()
Div [ Text "HELLO THERE" ]
module Controls =
open IntelliFactory.WebSharper
type HelloControl() =
inherit Web.Control()
[<JavaScript>]
override this.Body = Client.MakeHelloDiv() :> _
(function()
{
var Global=this,Runtime=this.IntelliFactory.Runtime,Website,Client,WebSharper,Html,Default,List,alert;
Runtime.Define(Global,{
Website:{
Client:{
MakeHelloDiv:function()
{
Client.SayHello();
return Default.Div(List.ofArray([Default.Text("HELLO THERE")]));
},
SayHello:function()
{
return alert("HELLO!");
}
},
Controls:{
HelloControl:Runtime.Class({
get_Body:function()
{
return Client.MakeHelloDiv();
}
})
}
}
});
Runtime.OnInit(function()
{
Website=Runtime.Safe(Global.Website);
Client=Runtime.Safe(Website.Client);
WebSharper=Runtime.Safe(Global.IntelliFactory.WebSharper);
Html=Runtime.Safe(WebSharper.Html);
Default=Runtime.Safe(Html.Default);
List=Runtime.Safe(WebSharper.List);
return alert=Runtime.Safe(Global.alert);
});
Runtime.OnLoad(function()
{
});
}());
(function(){var $$=this,$=this.IntelliFactory.Runtime,a,b,c,d,e,f,g;$.Define($$,{Website:{Client:{MakeHelloDiv:function(){b.SayHello();return e.Div(f.ofArray([e.Text("HELLO THERE")]));},SayHello:function(){return g("HELLO!");}},Controls:{HelloControl:$.Class({get_Body:function(){return b.MakeHelloDiv();}})}}});$.OnInit(function(){a=$.Safe($$.Website);b=$.Safe(a.Client);c=$.Safe($$.IntelliFactory.WebSharper);d=$.Safe(c.Html);e=$.Safe(d.Default);f=$.Safe(c.List);return g=$.Safe($$.alert);});$.OnLoad(function(){});}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment