Permalink
Browse files

Add lazy loading and update README

  • Loading branch information...
1 parent d9240fb commit 290bbe59c7394714d8f6e5a36f1443e42d316c69 @mortalapeman committed Apr 26, 2014
Showing with 13 additions and 1 deletion.
  1. +5 −0 README.md
  2. +8 −1 src/lt/plugins/tern.cljs
View
@@ -22,6 +22,11 @@ The default configuration for Tern is the browser environment `(:lt.plugins.tern
(:lt.plugins.tern/plugin :node true)]}
:- {:tern.config [:lt.plugins.tern/libs]}}
+To setup a configuration for RequireJS:
+
+ {:+ {:tern.config [(:lt.plugins.tern/plugin :requirejs {:baseURL "/home/path/to/project/dir"})
+ :lt.plugins.tern/lazy-loading]}}
+
Arguments to `:lt.plugins.tern/libs` can be:
1. One or many built in libs: `:ecma5 :browser :jquery :underscore`
@@ -325,7 +325,9 @@
(.on worker "message" msg)
(.on worker "disconnect" dis)
(.on worker "exit" dis)
- (current-ws-jsfiles init-cb)
+ (if (object/raise-reduce config :lazy-loading+ false)
+ (init-cb nil [])
+ (current-ws-jsfiles init-cb))
(object/merge! this {::worker worker})))))
(behavior ::error
@@ -432,6 +434,11 @@
(object/update! this [:options :plugins] conj value)))))
+(behavior ::lazy-loading
+ :triggers #{:lazy-loading+}
+ :reaction (fn [this _ _]
+ true))
+
(object/object* ::tern.config
:tags #{:tern.config}
:options {:libs #{}

0 comments on commit 290bbe5

Please sign in to comment.