Is there a way to extend default `Layer` getters/setters? In other words, it would be nice to do something like:
@define "width", get: -> super # custom shtuff
FB posts ate my indentation :(
Yes... I did this in a module once already. I'd have to dig up... But it's possible if you extend Layer.
Cool! Yeah, I was trying to augment `Layer#width` in my label module (https://github.com/peteschaffner/framer-label), which does indeed extend `Layer`. If you find that example and don't mind sharing, it would be greatly appreciated!
Here is how I approached it: http://jrdn.io/bq1B
Thanks for sharing man. Unfortunately I don't see what you mentioned, as the getter/setter shown in that screenshot didn't already exist on `Layer.prototype`. I was looking for a way to extend the behavior of an existing property (in my case, `width`).
So if yout extend the layer and then do the define getter and setter it doesn't work?
What are you looking to achieve? You can extend the Layer class and make your own if you want. (whoops did not see the above)
It works but I loose the original getter/setter behavior because I am overriding it at that point. I would like to maintain the behavior of `width` but add a call to update my module in other ways. So in other words:
@define "width", set: (value) -> super value print "I've augmented `Layer#width`"
Well you need to set: (value) for one...
This question I'm not sure about...if you want to start with writing some pseudo code example that you could share I could try to help.
Whoops, good catch. But yeah, still no cigar. I will whip up an example. Thanks for the help Jordan Robert Dobson and Rory Smyth.
Definitely I have a few days off in between work so I'm glad to help... I just need coffee...
Were you going to put up any code?
Hey sorry, got hung up last night :( I will link to some code later this morning!
Ok, here is an example that illustrates how re-defining `width` on my extended `Layer` class just clobbers the original getter/setter. If I was trying to extend regular old instance methods (not getters/setters), this would be trivial, as I could `super` within the "new" implementation.
BTW Jordan Robert Dobson, let me know how I can get you that coffee ;)
Ahhha! I got it: http://share.framerjs.com/vp32dbccvb2t/
Crap! Completely forgot about this!!! Sorry.
Taking a look today. Thanks Pete.
Ah... yeah... but subclassing... I wish there was a way to Monkey Patch in Coffee Script.