Hey everyone, I'm having an issue with the latest version, it throws this error on my previously working projects: "Layer.on needs a valid event name".
I think this happens on projects where I'm using custom event listeners, like:myLayer.on "change:customAttribute", ->
I'll try to replicate in a project that I can share, but just wanted to know if you've encountered this issue.
And btw, Framer team: awesome work on the new update, this makes your subscription model so valuable!
Yeah I'd love to see a small repro and fix it. Thanks!
Koen Bok, in the meantime, what's the best way to rollback Studio to an earlier version?
I think you only have to replace your framer.js for this. You can find the old version in the framer folder in your project if you updated through Studio. If not, you can download any old version here: http://builds.framerjs.com/
Hey I tried to repro this but cannot. The error is easy, it is expecting some string value for the event, in your case "change:customAttribute". Are you sure you are passing an actual event in your code?
I think I tracked down the problem. We had been attaching properties arbitrarily to the Events object in some of our modules like so:@emit Events.Change
Then checking for it using:layer.on Events.Change
It appears that changing this to a string fixes the problem.
I am curious about why this changed, though.
What type was Events.Change, a number?
The reason why I built this check in was that you can make a typo like Events.Cilck and those are really hard to spot.
No, we just emitted Events.Change. Never assigned it anything.
But then it's `undefined` right? So Events.Change would also trigger Events.Anything.
Hahaha! Oh man... so many bugs we ran into make so much sense right now. You're absolutely right.
Awesome finding Chris, yes, it works if in my module I change @emit Events.Changeto @emit "Events.Change"
Then in my Framer project I usemyLayer.on "Events.Change"
And yes Koen, this was the same as Events.Anything, definitely bad form we had in there...
Well, we know that the check works at least. Now if it were only less confusing :-)
This raises another question for you, Koen. Why did you guys abstract the strings to the Events object in the first place?
So we could do autocomplete like Events. ... But now we have layer.on... which is a lot nicer I think.
Also because it's good to have them organized somewhere I guess. You can still totally use the dom events like "mouseover".
I've the same issue, here is the same project with previous version of Framer: http://share.framerjs.com/xj567e08fgbk/ and this is the same code with updated Framer (does not work and gives me this error) http://share.framerjs.com/umsd3vzlix8q/
Koen Bok so is this one a bug?
Not really, it is a stricter check to avoid errors. This means you did not pass an event name so like layer.on(undefined, ...). I check for this because it can lead to very unexpected results.
You mean like this? or what am I doing wrong now? http://share.framerjs.com/dx6g5fr5jfap/
by the way, the original project works perfectly without adding (event) in all cases but one: it seems that "DragAnimationDidEnd" does not work in the new version of Framer
I'll add aliases for DragAnimationDidEnd
Thanks! btw not one of these actually works now