Hey, what design patterns are people using for framer? Complex prototypes get messy so easily...
I'm bundling a lot of my functionality into classes which I place in modules and using event firing to communicate between the apps. For a while I was passing an array of methods to my classes asking them to call them for specific events.
Oh and lots of helper classes... like Pointer.isInCircle(circle, point) or Pointer.isInRect(rect, point) or Pointer.coords(event, layer) # This helps me get correct coordinates between desktop and mobile.
Sounds like something you should publish like a module jordan!
Yeah... I wrote a few of these for work... I just need time to pull these little goodies out... And then fully bake them. :) They weren't very clean or publiclly ready. I hope some of that helps though.
You know this will never happen - to actually have time to clean it up and make it ready for public :-) 80/20 rule... Just share them as they are ;-)
It does happen... plus, the way they are, I would probably get more questions asking about WTF I was doing here or there... my answer would likely be "UH, I was rushing my code for a meeting". :P
Yeah... some of it just doesn't make sense out of context... and bits and pieces are scattered.
But... since you asked for it... here's one example: http://jrdn.io/aSpe
Here's one more for you: http://jrdn.io/aT0C
^ I dislike a lot of things about what I'm doing above... mostly naming of the class...etc.
Joakim - I used to do events like this before: http://jrdn.io/aT4v Then I realized I needed an event controller to keep everything clean.
Nice stuff, man! It seems like you really know your stuff
Dude... just start to keep your stuff in classes... That way it's easier to dig through now, and later, in regards to what they handle specifically.
It helps keep it organized in your head what your App handles (events, organizing main View layers)... what a ViewLayer handles (it's contents and hit areas)... What a ViewShell handles (multiple view layers, nav bar, drag / scroll listeners, communication between the View Layers )... etc.
Just start small with helper classes like my Move class to encapsulate logic... and eventually you'll get the hang of it.
Would this be helpful for anyone to have? I like, during my layer setup, to be able to specify the style, states to add, html... as well as a few other things: http://jrdn.io/aSOP
Hey Jordan, you can ditch the . in @.x etc (@x).
Oh... yeah... duh!
Koen Bok - Like so? http://jrdn.io/aSUh
Thanks Koen - Old code dies hard.
Hmm looking at all this stuff, I think it's just a matter of time till someone builds some framework, or another layer of abstraction on top of Framer. There's so much stuff that needs to be put into modules rather than reinventing the wheel over and over again. Or am I wrong?
Sure.. some already exist out there... This is all just coffeescript after all. I tend to build just the parts that I need instead of brining in an entire framework... but yeah I think eventually Framer will get there as more users provide feedback and build modules... I assume the popular modules will eventually end up being obsolete as they get added into framer core.