Skip to content

Commit 861ec70

Browse files
committed
Cleanup towards release
1 parent fb47ef3 commit 861ec70

File tree

9 files changed

+22
-26
lines changed

9 files changed

+22
-26
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
## 0.1
2-
* First release
1+
## 0.2
2+
* First public release
3+

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2016, Andy Gill
1+
Copyright (c) 2016-2019, The University of Kansas
22

33
All rights reserved.
44

@@ -13,7 +13,7 @@ modification, are permitted provided that the following conditions are met:
1313
disclaimer in the documentation and/or other materials provided
1414
with the distribution.
1515

16-
* Neither the name of Andy Gill nor the names of other
16+
* Neither the name of The University of Kansas nor the names of other
1717
contributors may be used to endorse or promote products derived
1818
from this software without specific prior written permission.
1919

README.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
# javascript-bridge [![Build Status](https://img.shields.io/travis/ku-fpg/javascript-bridge.svg?style=flat)](https://travis-ci.org/ku-fpg/javascript-bridge)
22

3-
**javascript-bridge** is an easy way of calling JavaScript from
4-
Haskell, using web-sockets as the underlying transport
3+
**javascript-bridge** is a straightforward way of calling JavaScript
4+
from Haskell, using web-sockets as the underlying transport
55
mechanism. Conceptually, javascript-bridge gives Haskell acccess to
6-
the JavaScript `eval` function. However, using a remote monad, as
7-
well as supporting evaluation of JavaScript fragments, we also support
8-
calling and returning values from JavaScript functions, constructing
9-
and using remote objects, and sending events from JavaScript to
10-
Haskell.
6+
the JavaScript `eval` function. However, we also support calling and
7+
returning values from JavaScript functions, constructing and using
8+
remote objects, and sending events from JavaScript to Haskell, all
9+
using a remote monad.
1110

12-
# High-level overview of API
11+
# Overview of API
1312

1413
**javascript-bridge** remotely executes JavaScript *fragments*.
1514
The basic Haskell idiom is.
@@ -45,8 +44,8 @@ then listening for the event in Haskell.
4544
```Haskell
4645
do -- Have JavaScript send an event to Haskell
4746
send eng $ command $ "event('Hello!')"
48-
-- Have Haskell wait for the event
49-
e :: String <- listen eng
47+
-- Have Haskell wait for the event, which is an Aeson 'Value'.
48+
e :: Value <- listen eng
5049
print e
5150
```
5251

@@ -67,13 +66,12 @@ app :: Engine -> IO ()
6766
app = send eng $ command "console.log('Hello!')"
6867
```
6968

70-
Next, include the following fragment in your HTML code,
71-
replacing *localhost* with your web address.
69+
Next, include the following fragment in your HTML code.
7270

7371
```HTML
7472
<script>
75-
jsb = new WebSocket('ws://localhost:3000/');
76-
jsb.onmessage = function(evt){ eval(evt.data);};
73+
window.jsb = {ws: new WebSocket('ws://' + location.host)};
74+
jsb.ws.onmessage = (evt) => eval(evt.data);
7775
</script>
7876
```
7977

examples/Main.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ <h2>Example</h2>
1010
<div id="target"></div>
1111
<script>
1212
// Bootstrap code
13-
window.jsb = {ws: new WebSocket('ws://' + location.host + '/')};
13+
window.jsb = {ws: new WebSocket('ws://' + location.host)};
1414
jsb.ws.onmessage = (evt) => eval(evt.data);
1515
// Debugging to JavaScript console
1616
jsb.debug = true;

examples/Multi.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ applet eng Promises = do
9494
render $ show (p2 :: String, p3 :: String)
9595
send eng $ do
9696
-- constructors create remote handles, and the
97-
-- handle can be a promise, and is constructed
97+
-- handle can be a promise, and is returned
9898
-- immeduately.
9999
p2 <- constructor $
100100
"new Promise((resolve,reject) => {" <>

javascript-bridge.cabal

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,12 @@ library
3030
Network.JavaScript.Services
3131
build-depends: base >= 4.9 && < 4.14
3232
, binary >= 0.8 && < 0.9
33-
, aeson >= 1.0 && < 1.5
33+
, aeson >= 1.4 && < 1.5
3434
, containers >= 0.5 && < 0.7
35-
, scientific >= 0.3.4.9 && < 0.4
3635
, stm >= 2.4 && < 2.6
3736
, text >= 1.2 && < 1.3
3837
, time >= 1.6 && < 1.10
3938
, transformers >= 0.4 && < 0.6
40-
, unordered-containers >= 0.2.7 && < 0.3
4139
, wai >= 3.2 && < 3.3
4240
, wai-websockets >= 3.0.1 && < 3.1
4341
, websockets >= 0.10 && < 0.13

src/Network/JavaScript/Internal.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ module Network.JavaScript.Internal
3333
import Data.Aeson (ToJSON(..), FromJSON(..))
3434
import qualified Data.Aeson.Encoding.Internal as AI
3535
import qualified Data.Binary.Builder as B
36-
import Data.Semigroup
3736
import Data.Text.Lazy(Text, pack)
3837
import Data.Text.Lazy.Encoding(encodeUtf8)
3938
import Data.String

stack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# resolver:
1616
# name: custom-snapshot
1717
# location: "./custom-snapshot.yaml"
18-
resolver: lts-8.9
18+
resolver: lts-13.6
1919

2020
# User packages to be built.
2121
# Various formats can be used as shown in the example below.

test/Main.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ main_ i = do
5656
, T.pack (table tests)
5757
, "</div>"
5858
, "<script>"
59-
, "window.jsb = {ws: new WebSocket('ws://' + location.host + '/')};"
59+
, "window.jsb = {ws: new WebSocket('ws://' + location.host)};"
6060
, "jsb.ws.onmessage = (evt) => eval(evt.data);"
6161
-- remote object to allow interesting commands and procedures
6262
, "var remote = [];"

0 commit comments

Comments
 (0)