Uncaught ReferenceError: reflex is not defined

272 views
Skip to first unread message

Pierre-Henry Perret

unread,
Jul 2, 2012, 11:53:56 AM7/2/12
to c2-...@googlegroups.com
Hi Kevin,

As an attempt to use C2 with ClojureScript , I get the following error in the chrome console:
_______________
Uncaught ReferenceError: reflex is not defined 
______________________

in that compiled code:
_____________________
var co__4993__auto____5594 = (new reflex.core.ComputedObservable(null, true, (function() { 
___________________________

I supppose it is the way C2 libs  are loaded by the application when it starts ?
Thx

Kevin Lynagh

unread,
Jul 2, 2012, 12:07:59 PM7/2/12
to c2-...@googlegroups.com
Pierre-Henry,

Seems like the reflex clojurescript is not getting included.
Doing a :use-macros is not enough, since the `bind!` macro expands into something that assumes reflex.core is loaded.
What you can do is explicitly require reflex.core in your namespace, which will ensure that it gets compiled in.
(This happens in c2.core: https://github.com/lynaghk/c2/blob/master/src/cljs/c2/core.cljs#L9, so my guess is that you're not requiring that namespace in your cljs either).

If that doesn't work, can you paste your cljs code in a gist?

best,

Kevin

--
Kevin Lynagh
Keming Labs
http://keminglabs.com
888.502.1042

Pierre-Henry Perret

unread,
Jul 3, 2012, 5:20:12 AM7/3/12
to c2-...@googlegroups.com
Kevin,

I try to use C2 with ClojureScriptOne framework.

I have included reflex.core and singult.core in the list.cljs (from your todo sample file) but without success. 
It seems that the framework interferes with the loading process of goog.require, in fact it doesn't even see the required libs (see git://gist.github.com/3038702.git )

Thanks

Kevin Lynagh

unread,
Jul 3, 2012, 10:45:02 AM7/3/12
to c2-...@googlegroups.com
This file looks fine.
I'm not familiar with ClojureScript One, though---does it use lein cljsbuild to compile?

It seems that the framework interferes with the loading process of goog.require,

What's the error that you're getting?
Same runtime error about reflex not being found?

Pierre-Henry Perret

unread,
Jul 3, 2012, 12:03:56 PM7/3/12
to c2-...@googlegroups.com


Le mardi 3 juillet 2012 16:45:02 UTC+2, Kevin Lynagh a écrit :
This file looks fine.
I'm not familiar with ClojureScript One, though---does it use lein cljsbuild to compile?

No , it doesn't use cljsbuild. Instead , when a file is changed , it automaically recompile it, reloading it to the page through a repl server .
 

It seems that the framework interferes with the loading process of goog.require,

What's the error that you're getting?
Same runtime error about reflex not being found?

Yes, same error. 

I'm exploring further.
Thanks for helping

--
Pierre-Henry 

Kevin Lynagh

unread,
Jul 3, 2012, 12:33:18 PM7/3/12
to c2-...@googlegroups.com

No , it doesn't use cljsbuild. Instead , when a file is changed , it automaically recompile it, reloading it to the page through a repl server .

Ah.
I do everything through cljsbuild, so your situation is a bit uncharted for me.
Be careful with advanced compilation---there are some externs and libs for Singult that get automatically picked up through cljsbuild but that ClojureScript One probably isn't seeing.

Pierre-Henry Perret

unread,
Jul 3, 2012, 12:36:09 PM7/3/12
to c2-...@googlegroups.com
Hi Kevin,

I have joined the screenshot of the console output when loading the app.

It's somewhat difficult to debug...
js-out.jpg

Kevin Lynagh

unread,
Jul 3, 2012, 12:42:48 PM7/3/12
to c2-...@googlegroups.com
It looks like I'll need to see the full source to figure out what's going on.
Reply all
Reply to author
Forward
0 new messages