-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Advanced compilation breaks mixins with custom methods #29
Comments
A (very ugly) workaround in the meantime is to use (.set-interval owner #(swap! state update-in [:seconds] inc) 1000)) ((aget owner "set-interval") #(swap! state update-in [:seconds] inc) 1000)) |
Yeah, I'm running into this too. This could probably be solved with a custom externs file - it does feel like something that we should be able to fix without resorting this, since the javascript's defined inline and should be handled by the cljs compiler, yeah? |
Yeah. The mixin is currently represented as a literal JS object that's given to React. Something along the lines of, var my_mixin = {"my_method": function() { ... }} And it's not being associated with a call like, (.my-method owner) There was a fix in ClojureScript 0.0-2301 that might be relevant: clojure/clojurescript@d7c8960 |
Yeah, I don't think that new version helps. We're on the latest CLJS version and the issue's still up. Just wanted to let you know! |
There's really no way to make this work with advanced compilation. Using JS object literals with string keys like that simply won't work with regular method invocation. You need to provide an externs file. |
@swannodette Do you have any suggestions how this externs file would need to look? I'm struggling a bit how, for example Beyond that, while I'd prefer if it worked as is, I'm Ok with writing an externs file for the handful of mixins that I use. I just don't know how right now. @loganlinn Would it be at all possible to change how the mixin is defined (not as a JS object literal) to side-step the issue? I'd be willing to try it and test, but I'd need some guidance as I don't really know where to start on such a thing. |
For the Object.my_method = function() {}; |
@swannodette 👍 Thanks! |
Reported here: https://groups.google.com/forum/#!topic/clojurescript/YVPnwIWaUVU
If a mixin has non-lifecycle methods (like the
set-interval
example), advanced compilation breaks invocations of those methods. Was able to reproduce on the mixin example with these changes.Call-site of
undefined is not a function
:Mixin is defined here: (note that it's getting inlined)
The text was updated successfully, but these errors were encountered: