aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Barksdale <amatus@amatus.name>2014-12-13 18:54:04 -0600
committerDavid Barksdale <amatus@amatus.name>2014-12-13 18:54:04 -0600
commit9e4859419263f76e4c4f694818966ce30167a62c (patch)
tree34b5f513c910a2289420bd5cfda9593d24f029a3
parent69d2a1fb783609e2f1bdecf3fafb658e99a7da1a (diff)
Use fence instead of ext.js files
window.crypto.ext.js stays because of the call in client-pre.js. We could do the same trick there but I'd like to keep the code readable.
-rw-r--r--build.boot3
-rw-r--r--src/cljs/gnunet_web/core.cljs5
-rw-r--r--src/cljs/gnunet_web/filesharing.cljs10
-rw-r--r--src/cljs/gnunet_web/transport.cljs10
-rw-r--r--src/hl/index.cljs.hl5
-rw-r--r--src/js/client-lib.ext.js1
-rw-r--r--src/js/semantic.ext.js1
7 files changed, 20 insertions, 15 deletions
diff --git a/build.boot b/build.boot
index 78025e7..82160c8 100644
--- a/build.boot
+++ b/build.boot
@@ -5,7 +5,8 @@
(set-env!
:project 'gnunet-web
:version "0.1.0-SNAPSHOT"
- :dependencies '[[net.clojure/monads "1.0.2"]
+ :dependencies '[[fence "0.2.0"]
+ [net.clojure/monads "1.0.2"]
[org.clojure/core.async "0.1.303.0-886421-alpha"]
[tailrecursion/boot.task "2.2.1"]
[tailrecursion/hoplon "5.10.22"]]
diff --git a/src/cljs/gnunet_web/core.cljs b/src/cljs/gnunet_web/core.cljs
index bee9e22..22d5a43 100644
--- a/src/cljs/gnunet_web/core.cljs
+++ b/src/cljs/gnunet_web/core.cljs
@@ -17,7 +17,8 @@
(ns gnunet-web.core
(:require [gnunet-web.service :as service] ;; leave this here
[gnunet-web.util :refer [get-object read-memory register-object
- unregister-object]]))
+ unregister-object]])
+ (:require-macros [fence.core :refer [+++]]))
(def core-handle (js/_GNUNET_CORE_connect
1 ; const struct GNUNET_CONFIGURATION_Handle *cfg
@@ -37,7 +38,7 @@
(callback {:peer (vec (read-memory peer-id-pointer 32))
:state state})))
-(def monitor-callback-pointer (js/Runtime.addFunction monitor-callback))
+(def monitor-callback-pointer (+++ (.addFunction js/Runtime monitor-callback)))
(defn monitor-peers
[callback]
diff --git a/src/cljs/gnunet_web/filesharing.cljs b/src/cljs/gnunet_web/filesharing.cljs
index 7be5617..c0cb288 100644
--- a/src/cljs/gnunet_web/filesharing.cljs
+++ b/src/cljs/gnunet_web/filesharing.cljs
@@ -21,7 +21,8 @@
[gnunet-web.util :refer [get-object i64-to-real read-memory
real-to-i64 register-object
unregister-object]])
- (:require-macros [cljs.core.async.macros :refer [go]]))
+ (:require-macros [cljs.core.async.macros :refer [go]]
+ [fence.core :refer [+++]]))
(defn uri-ksk-create
[query]
@@ -68,7 +69,8 @@
(js/Pointer_stringify data)
(read-memory data data-size))})))
-(def metadata-iterator-pointer (js/Runtime.addFunction metadata-iterator))
+(def metadata-iterator-pointer
+ (+++ (.addFunction js/Runtime metadata-iterator)))
(defn parse-progress-publish
[status info-pointer]
@@ -177,7 +179,7 @@
js/_GNUNET_FS_start
"number"
(array "number" "string" "number" "number" "number" "array")
- (array 0 "gnunet-web" (js/Runtime.addFunction progress-callback) 0 0
+ (array 0 "gnunet-web" (+++ (.addFunction js/Runtime progress-callback)) 0 0
(array 0))))
(defn start-search
@@ -229,7 +231,7 @@
size)))
(def publish-reader-callback-pointer
- (js/Runtime.addFunction publish-reader-callback))
+ (+++ (.addFunction js/Runtime publish-reader-callback)))
(defn new-block-options
[{:keys [expiration anonymity priority replication]}]
diff --git a/src/cljs/gnunet_web/transport.cljs b/src/cljs/gnunet_web/transport.cljs
index 12bdad9..07f97c2 100644
--- a/src/cljs/gnunet_web/transport.cljs
+++ b/src/cljs/gnunet_web/transport.cljs
@@ -20,7 +20,8 @@
[gnunet-web.service :as service] ;; leave this here
[gnunet-web.util :refer [get-object read-memory register-object
unregister-object]])
- (:require-macros [cljs.core.async.macros :refer [go go-loop]]))
+ (:require-macros [cljs.core.async.macros :refer [go go-loop]]
+ [fence.core :refer [+++]]))
(def state-strings
{0 "Not connected"
@@ -68,7 +69,8 @@
(js/_GNUNET_TRANSPORT_get_hello_cancel @(:handle closure))
(unregister-object cls)))
-(def get-hello-callback-pointer (js/Runtime.addFunction get-hello-callback))
+(def get-hello-callback-pointer
+ (+++ (.addFunction js/Runtime get-hello-callback)))
(defn get-my-peer-id
[callback]
@@ -92,7 +94,7 @@
(go (>! ch (js/Pointer_stringify string-pointer)))))))
(def address->string-callback-pointer
- (js/Runtime.addFunction address->string-callback))
+ (+++ (.addFunction js/Runtime address->string-callback)))
(defn address->string
[address-pointer]
@@ -118,7 +120,7 @@
:address (<! ch)})
(close! ch)))))))
-(def monitor-callback-pointer (js/Runtime.addFunction monitor-callback))
+(def monitor-callback-pointer (+++ (.addFunction js/Runtime monitor-callback)))
(defn monitor-peers
[callback]
diff --git a/src/hl/index.cljs.hl b/src/hl/index.cljs.hl
index e5fec00..4c5e66d 100644
--- a/src/hl/index.cljs.hl
+++ b/src/hl/index.cljs.hl
@@ -24,7 +24,8 @@
[gnunet-web.service :as service]
[gnunet-web.transport :as transport]
[gnunet-web.util :refer [now]])
- (:require-macros [cljs.core.async.macros :refer [go go-loop]]))
+ (:require-macros [cljs.core.async.macros :refer [go go-loop]]
+ [fence.core :refer [+++]]))
(set! *print-fn* #(.log js/console %))
@@ -203,7 +204,7 @@
(defn dropdownify
[dropdown]
- (with-init! (.dropdown (js/$ dropdown)))
+ (with-init! (+++ (.dropdown (js/$ dropdown))))
dropdown)
(defelem ui-anonymity
diff --git a/src/js/client-lib.ext.js b/src/js/client-lib.ext.js
deleted file mode 100644
index 277bd76..0000000
--- a/src/js/client-lib.ext.js
+++ /dev/null
@@ -1 +0,0 @@
-Runtime.addFunction = function() {};
diff --git a/src/js/semantic.ext.js b/src/js/semantic.ext.js
deleted file mode 100644
index 73a8335..0000000
--- a/src/js/semantic.ext.js
+++ /dev/null
@@ -1 +0,0 @@
-$(x).dropdown()