Created
December 26, 2012 19:36
-
-
Save anonymous/4382511 to your computer and use it in GitHub Desktop.
`property` method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class athena.lib.Model | |
property: (property) => | |
(value) => | |
if value? | |
@model.set property, value | |
else | |
@model.get property |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class YouTubeShell.Model extends VideoLinkShell.Model | |
# get/setter | |
startTime: => (@property 'startTime') ...arguments | |
# getter only | |
getYouTubeAPIData: => (@property 'ytData')() | |
# set value from youtube api before returning | |
getTotalTime: => | |
if @YouTubeAPI.duration then (@property 'totalTime') @YouTubeAPI.duration | |
(@property 'totalTime')() | |
# setter only, in case you ever wanted one | |
setUngettableValue: => | |
(@property 'ungettableValue') ...arguments | |
undefined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment