Commit 2df44bc8 authored by Ricardo J. Mendez's avatar Ricardo J. Mendez

Listing open tabs on click

https://app.asana.com/0/50978096561390/50978508466350

Using a local, WIP version of khroma as well as my own chromebuild fork

https://github.com/ricardojmendez/khroma/
https://github.com/ricardojmendez/lein-chromebuild
parent 720cc741
......@@ -4,11 +4,11 @@
:dependencies [[org.clojure/clojure "1.7.0"]
[org.clojure/clojurescript "1.7.122"]
[org.clojure/core.async "0.1.346.0-17112a-alpha"]
[khroma "0.0.2"]
[khroma "0.0.3-SNAPSHOT"]
[prismatic/dommy "1.1.0"]]
:source-paths ["src"]
:profiles {:dev {:plugins [[lein-cljsbuild "1.1.0"]
[lein-chromebuild "0.2.1"]]
[lein-chromebuild "0.3.0"]]
:cljsbuild {:builds {:main
{:source-paths ["src"]
......
......@@ -2,28 +2,38 @@
"name": "tabler",
"version": "0.1",
"browser_action": {
"default_title": "Show the popup",
"default_popup": "popup.html",
"default_icon": {
"19": "icon19.png",
"38": "icon38.png"
}
"default_title": "Show the popup",
"scripts": ["handler.js"],
"default_icon": {
"19": "icon19.png",
"38": "icon38.png"
}
},
"icons": {
"16": "icon16.png",
"48": "icon48.png",
"128": "icon128.png"
},
"content_scripts": [
"permissions": [
"tabs"
],
"content_scripts": [
{
"matches": ["*://*/*"],
"js": ["tabler.js", "content.js"],
"matches": [
"*://*/*"
],
"js": [
"tabler.js",
"content.js"
],
"run_at": "document_end"
}
],
"background": {
"scripts": ["tabler.js", "background.js"],
"scripts": [
"tabler.js",
"background.js"
],
"persistent": false
},
"manifest_version": 2
......
(ns tabler.content
(:require [khroma.runtime :as runtime]
[khroma.log :as console]
[khroma.tabs :as tabs]
[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 "On content")
(console/log "Background said: " (<! bg)))))
(ns tabler.handler
(:require [khroma.log :as console]
[khroma.browser :as browser]
[khroma.tabs :as tabs]
[khroma.windows :as windows]
[cljs.core.async :refer [>! <!]])
(:require-macros [cljs.core.async.macros :refer [go]]))
(defn init []
(console/log "tabler.handler.init")
(let [conns (browser/on-click)]
(go (while true
(let [tab (<! conns)]
(console/log "On click handler. Tab: " tab)
(console/log "On window: " (<! (windows/get-current)))
(console/log "Active tab:" (<! (tabs/get-active-tab))))
))))
(init)
\ No newline at end of file
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