Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update examples and modules to not use

  • Loading branch information...
commit 4fbcb174a3f1078298793351c8b5ba081331878b 1 parent 56c2e59
@marcuswestin authored
View
8 examples/composit_statements.js
@@ -6,14 +6,14 @@ import mouse
"mouse: " mouse <br/>
"mouse.x + 50: " mouse.x + 50 <br/>
\"hello\" + mouse.x + 50: "hello" + mouse.x + 50 <br/>
-var foo = 40
-var bar = mouse.x
+foo = 40
+bar = mouse.x
"foo + bar + 50: " foo + bar + 50: <br/>
'</pre>
"mouse: " mouse <br/>
"mouse.x + 50: " mouse.x + 50 <br/>
"\"hello\" + mouse.x + 50: " "hello" + mouse.x + 50 <br/>
-var foo = 40
-var bar = mouse.x
+foo = 40
+bar = mouse.x
"foo + bar + 50: " foo + bar + 50 <br/>
View
4 examples/drag.fun
@@ -3,10 +3,10 @@ import mouse
"Two divs that follow the mouse."
<pre>'
-var offset = 25
+offset = 25
<div id="output1" style={ background:"red", width:100, height:100, position:"absolute", top:mouse.y + offset, left:mouse.x + offset }/>
<div id="output2" style={ background:"blue", width:50, height:50, position:"absolute", top:mouse.y + offset + 25, left:mouse.x + offset + 25 }/>
'</pre>
-var offset = 25
+offset = 25
<div id="output1" style={ background:"red", width:100, height:100, position:"absolute", top:mouse.y + offset, left:mouse.x + offset }/>
<div id="output2" style={ background:"blue", width:50, height:50, position:"absolute", top:mouse.y + offset + 25, left:mouse.x + offset + 25 }/>
View
8 examples/drag2.fun
@@ -4,14 +4,14 @@ import localstorage
"A draggable square that's sticky between page reloads"
<pre>"
-let drag = {
+drag = {
pos:{ x:100, y:100 },
offset:{ x:0, y:0 }
}
localstorage.persist(drag, 'drag')
-let dragStyle = {
+dragStyle = {
cursor:'move',
width:100,
height:100,
@@ -36,14 +36,14 @@ let dragStyle = {
>
"</pre>
-let drag = {
+drag = {
pos:{ x:100, y:100 },
offset:{ x:0, y:0 }
}
localstorage.persist(drag, 'drag')
-let dragStyle = {
+dragStyle = {
cursor:'move',
width:100,
height:100,
View
4 examples/for-loops.fun
@@ -11,13 +11,13 @@ for (number in [1,2,3]) {
<pre>"
-var person = { name:'Marcus', likes:'Ice cream' }
+let person = { name:'Marcus', likes:'Ice cream' }
for (value in person) {
<div>value</div>
}
"
</pre>
-var person = { name:'Marcus', likes:'Ice cream' }
+person = { name:'Marcus', likes:'Ice cream' }
for (value in person) {
<div>value</div>
}
View
2  examples/image.fun
@@ -1,4 +1,4 @@
-var pictureURL = ""
+pictureURL = ""
<pre>'
<div style={ margin: 10, padding: 5, border: "2px solid #999", width: 500 }>
View
2  examples/switch.fun
@@ -1,6 +1,6 @@
// This example is currently broken. Need to make it work :)
-var state = 'foo'
+state = 'foo'
"Local.state: " <input data=state /> "(try foo, bar, and others)"
View
16 specification/types.md
@@ -6,15 +6,15 @@ Interfaces
----------
The value types can be combined into interfaces:
- let User = { id:Number, name:Text }
- let ListOfNumbers = [Number]
- let ListOfUsers = [User]
- let HashOfNumbers = <Number>
- let HashOfUsers = <User>
+ User = { id:Number, name:Text }
+ ListOfNumbers = [Number]
+ ListOfUsers = [User]
+ HashOfNumbers = <Number>
+ HashOfUsers = <User>
Handlers, Templates and Functions can specify the interfaces that they expect. Code that calls them must pass in values that conform to the expected interfaces:
- let drawUser = template(User user) {
+ drawUser = template(User user) {
<div class="user">
"Name: " user.name
</div>
@@ -25,7 +25,7 @@ Handlers, Templates and Functions can specify the interfaces that they expect. C
The expected interface can be inlined, though it's good practice to explicitly name interfaces.
For example, drawUser does not depend on user.id so it could specify a smaller interface:
- let drawUser2 = template({ name:Text } user) {
+ drawUser2 = template({ name:Text } user) {
<div class="user">"Name: " user.name</div>
}
drawUser2({ id:1, name:"Marcus" }) // this runs
@@ -40,7 +40,7 @@ Old example of possible example typed chat app:
#import WebSocket
- let Message = { body:Text }
+ Message = { body:Text }
var [Message] messages = []
View
2  src/modules/facebook.fun
@@ -1,6 +1,6 @@
import Local
-let facebook = {
+facebook = {
connected: false,
connect: javascriptHandler("facebookModule.connect"),
user: {
View
2  src/modules/filter.fun
@@ -1,4 +1,4 @@
-let filter = function(list, func) {
+filter = function(list, func) {
<script list=list func=func>
var result = [],
items = list.getContent()
View
2  src/modules/jsonp.fun
@@ -1,4 +1,4 @@
-let jsonp = {
+jsonp = {
get:function(path, args, responseHandler) {
let result = { loading:true, error:null, response:null }
<script path=path args=args responseHandler=responseHandler result=result>
View
2  src/modules/localstorage.fun
@@ -1,4 +1,4 @@
-let localstorage = {
+localstorage = {
// TODO Make this a template so that it doesn't execute multiple times
persist:function(variable, name) {
<script variable=variable name=name>
View
2  src/modules/location.fun
@@ -1,6 +1,6 @@
import Local
-let location = {
+location = {
navigate: javascriptHandler("locationModule.navigate"),
state: '',
}
View
2  src/modules/mouse.fun
@@ -1,4 +1,4 @@
-let mouse = {
+mouse = {
x: 0,
y: 0,
isDown: false
View
2  src/modules/twitter.fun
@@ -1,4 +1,4 @@
-let twitter = {
+twitter = {
search:function(searchQuery) {
// var result = { loading:true, error:null, response:null }
var result = null
View
4 src/modules/xhr.fun
@@ -1,4 +1,4 @@
-let xhr = {
+xhr = {
post:function(path, args, responseHandler) {
return xhr._send('post', path, args, responseHandler)
},
@@ -6,7 +6,7 @@ let xhr = {
return xhr._send('get', path, args, responseHandler)
},
_send: function(method, path, args, responseHandler) {
- let result = { loading:true, error:null, response:null }
+ result = { loading:true, error:null, response:null }
<script method=method path=path args=args responseHandler=responseHandler result=result>
if (!__hackFirstExecution) { return }
var xhr = require('std/xhr')
Please sign in to comment.
Something went wrong with that request. Please try again.