Last active
August 29, 2015 14:25
-
-
Save qwe2/a980344a7b4eba67edfe to your computer and use it in GitHub Desktop.
SimpleTextBox
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
namespace SimpleTextBox | |
open WebSharper | |
open WebSharper.UI.Next | |
open WebSharper.UI.Next.Html | |
[<JavaScript>] | |
module Client = | |
// Note that Main here is not a function. This is very important as top-level | |
// let bindings will be invoked when the app starts. | |
let Main = | |
// Create a reactive variable and view. | |
// Reactive *variables* are data *sources*. | |
let rvText = Var.Create "" | |
// Create the components backed by the variable: in this case, an input | |
// field and a label to display the contents of such a field. | |
// The inputField is created using RD.Input, which takes an RVar as its | |
// parameter. Whenever the input field is updated, the new value is | |
// automatically placed into the variable. | |
let inputField = Doc.Input [Attr.Class "form-control"] rvText | |
// A TextView is a component, backed by a reactive view, that updates | |
// its contents automatically whenever the variable changes. | |
let label = Doc.TextView rvText.View | |
// Put together our RDOM structures; some bootstrap stuff | |
Div [ Attr.Class "panel-default" ] [ | |
Div [ Attr.Class "panel-body" ] [ | |
// Note how components are composable, meaning we can | |
// embed multiple different components here without issue. | |
Div0 [inputField] | |
Div0 [label] | |
] | |
] | |
|> Doc.RunById "entry" |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>SimpleTextBox</title> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<link rel="stylesheet" type="text/css" href="Content/SimpleTextBox.css" /> | |
<script type="text/javascript" src="Content/SimpleTextBox.head.js"></script> | |
</head> | |
<body> | |
<div id="entry"></div> | |
<!--Script is included AFTER the entry point and has the name of your project. | |
For production use .min.js for debugging and development use .js.--> | |
<script type="text/javascript" src="Content/SimpleTextBox.js"></script> | |
</body> | |
</html> |
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
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<!-- NOTE: comment the following to run on F# 3.0 --> | |
<runtime> | |
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | |
<dependentAssembly> | |
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> | |
<bindingRedirect oldVersion="0.0.0.0-4.3.1.0" newVersion="4.3.1.0" /> | |
</dependentAssembly> | |
<dependentAssembly> | |
<assemblyIdentity name="WebSharper.Main" publicKeyToken="dcd983dec8f76a71" culture="neutral" /> | |
<bindingRedirect oldVersion="0.0.0.0-3.3.0.0" newVersion="3.2.0.0" /> | |
</dependentAssembly> | |
<dependentAssembly> | |
<assemblyIdentity name="WebSharper.Html.Client" publicKeyToken="dcd983dec8f76a71" culture="neutral" /> | |
<bindingRedirect oldVersion="0.0.0.0-3.3.0.0" newVersion="3.2.0.0" /> | |
</dependentAssembly> | |
<dependentAssembly> | |
<assemblyIdentity name="WebSharper.JavaScript" publicKeyToken="dcd983dec8f76a71" culture="neutral" /> | |
<bindingRedirect oldVersion="0.0.0.0-3.3.0.0" newVersion="3.2.0.0" /> | |
</dependentAssembly> | |
<dependentAssembly> | |
<assemblyIdentity name="WebSharper.JQuery" publicKeyToken="dcd983dec8f76a71" culture="neutral" /> | |
<bindingRedirect oldVersion="0.0.0.0-3.3.0.0" newVersion="3.2.0.0" /> | |
</dependentAssembly> | |
<dependentAssembly> | |
<assemblyIdentity name="WebSharper.Core" publicKeyToken="dcd983dec8f76a71" culture="neutral" /> | |
<bindingRedirect oldVersion="0.0.0.0-3.3.0.0" newVersion="3.2.0.0" /> | |
</dependentAssembly> | |
<dependentAssembly> | |
<assemblyIdentity name="WebSharper.Html.Server" publicKeyToken="dcd983dec8f76a71" culture="neutral" /> | |
<bindingRedirect oldVersion="0.0.0.0-3.2.0.0" newVersion="3.2.0.0" /> | |
</dependentAssembly> | |
<dependentAssembly> | |
<assemblyIdentity name="WebSharper.Sitelets" publicKeyToken="dcd983dec8f76a71" culture="neutral" /> | |
<bindingRedirect oldVersion="0.0.0.0-3.2.0.0" newVersion="3.2.0.0" /> | |
</dependentAssembly> | |
<dependentAssembly> | |
<assemblyIdentity name="WebSharper.Core.JavaScript" publicKeyToken="dcd983dec8f76a71" culture="neutral" /> | |
<bindingRedirect oldVersion="0.0.0.0-3.3.0.0" newVersion="3.2.0.0" /> | |
</dependentAssembly> | |
<dependentAssembly> | |
<assemblyIdentity name="WebSharper.Web" publicKeyToken="dcd983dec8f76a71" culture="neutral" /> | |
<bindingRedirect oldVersion="0.0.0.0-3.2.0.0" newVersion="3.2.0.0" /> | |
</dependentAssembly> | |
</assemblyBinding> | |
</runtime> | |
<system.web> | |
<compilation debug="true" targetFramework="4.0" /> | |
</system.web> | |
</configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment