Last active
January 3, 2016 04:49
-
-
Save darthdeus/8411616 to your computer and use it in GitHub Desktop.
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
(ns lt.tutorial | |
(:require [lt.object :as object] | |
[lt.objs.tabs :as tabs] | |
[lt.objs.statusbar :as statusbar] | |
[lt.objs.notifos :as notifos] | |
[lt.util.js :as util]) | |
(:require-macros [lt.macros :refer [behavior defui]])) | |
(defui work-button [this] | |
[:input {:type "submit" :value "Do work"}] | |
:click #(object/raise this :clicked %)) | |
(object/object* ::worker | |
:name "A hard worker" | |
:behaviors [::work-on-click ::on-close-destroy] | |
:init (fn [this] (work-button this))) | |
(behavior ::work-on-click | |
:triggers #{:clicked} | |
:reaction (fn [this] | |
(notifos/working "Doing some heavy lifting!") | |
(util/wait 10000 #(statusbar/loader-set 0)))) | |
(behavior ::on-close-destroy | |
:triggers #{:close} | |
:reaction (fn [this] | |
(when-let [ts (:lt.objs.tabs/tabset @this)] | |
(when (= (count (:objs @ts)) 1) | |
(tabs/rem-tabset ts))) | |
(object/raise this :destroy))) | |
(let [worker (object/create ::worker)] | |
(tabs/add! worker) | |
(tabs/active! worker)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is causing: TypeError: Cannot call method 'call' of undefined
Googling isn't helping and the lightable freenode doesn't seem very active.
I know its not specific to your code, but do you have any idea what it's about?