Commit 4b26cf9c authored by Ricardo J. Mendez's avatar Ricardo J. Mendez

Initial commit from template

parents
/target
*.iml
.idea
/classes
/checkouts
pom.xml
pom.xml.asc
*.jar
*.class
/.lein-*
/.nrepl-port
*~
*.log
resources/public/js/
(defproject tabler "0.1.0-SNAPSHOT"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.5.1"]
[org.clojure/clojurescript "0.0-2156"]
[org.clojure/core.async "0.1.242.0-44b1e3-alpha"]
[khroma "0.0.2"]
[prismatic/dommy "0.1.2"]]
:source-paths ["src"]
:profiles {:dev {:plugins [[com.cemerick/austin "0.1.3"]
[lein-cljsbuild "1.0.1"]
[lein-chromebuild "0.2.1"]]
:cljsbuild {:builds {:main
{:source-paths ["src"]
:compiler {:output-to "target/unpacked/tabler.js"
:output-dir "target/js"
:optimizations :whitespace
:pretty-print true}}}}
}})
<script type="text/javascript" src="tabler.js"></script>
<script type="text/javascript" src="popup.js"></script>
A wild tabler appears
tabler.background.init();
tabler.content.init();
{
"name": "tabler",
"version": "0.1",
"browser_action": {
"default_title": "Show the popup",
"default_popup": "popup.html",
"default_icon": {
"19": "icon19.png",
"38": "icon38.png"
}
},
"icons": {
"16": "icon16.png",
"48": "icon48.png",
"128": "icon128.png"
},
"content_scripts": [
{
"matches": ["*://*/*"],
"js": ["tabler.js", "content.js"],
"run_at": "document_end"
}
],
"background": {
"scripts": ["tabler.js", "background.js"],
"persistent": false
},
"manifest_version": 2
}
tabler.popup.init();
(ns tabler.background
(:require [khroma.log :as console]
[khroma.runtime :as runtime]
[cljs.core.async :refer [>! <!]])
(:require-macros [cljs.core.async.macros :refer [go]]))
(defn init []
(go (let [conns (runtime/connections)
content (<! conns)]
(console/log "Content script said: " (<! content))
(>! content :fml-i-am-the-background-script)
(init))))
(ns tabler.content
(:require [khroma.runtime :as runtime]
[khroma.log :as console]
[cljs.core.async :refer [>! <!]])
(:require-macros [cljs.core.async.macros :refer [go]]))
(defn init []
(let [bg (runtime/connect)]
(go (>! bg :lol-i-am-a-content-script)
(console/log "Background said: " (<! bg)))))
(ns tabler.popup
(:require [khroma.runtime :as runtime]
[khroma.log :as console]
[cljs.core.async :refer [>! <!]])
(:require-macros [cljs.core.async.macros :refer [go]]))
(defn init []
(let [bg (runtime/connect)]
(go (>! bg :lol-i-am-a-popup)
(console/log "Background said: " (<! bg)))))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment