forked from puffnfresh/roy
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e09229e
commit 12a5b62
Showing
1 changed file
with
8 additions
and
11 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,18 @@ | ||
let deferred = { | ||
return: \x -> $.when(x) | ||
return: \x -> $.when x | ||
bind: \x f -> | ||
let dfd = $.Deferred() | ||
x.done(\val -> | ||
(f val).done(\val2 -> dfd.resolve val2) | ||
let dfd = $.Deferred () | ||
x.done (\val -> | ||
(f val).done dfd.resolve | ||
) | ||
dfd.promise() | ||
dfd.promise () | ||
} | ||
|
||
let v = (do deferred | ||
let v = do deferred | ||
val <- $.ajax 'examples/helloworld.roy' | ||
val2 <- $.ajax 'examples/alias.roy' | ||
return val ++ val2 | ||
) | ||
|
||
(do deferred | ||
text <- v | ||
console.log text | ||
return text | ||
v.done (\x -> | ||
console.log x | ||
) |