Last active
August 29, 2015 14:27
-
-
Save ed-lea/06c63ce718991ada63cf to your computer and use it in GitHub Desktop.
Define a new variable in FramerJS Layer class
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 Main extends Layer | |
| constructor: (options={}) -> | |
| # override Layer default | |
| options.width ?= 200 | |
| # introduce a new property | |
| options.newProperty ?= 123 | |
| super options | |
| @define "newProperty", | |
| get: -> @_newProperty | |
| set: (value) -> | |
| @_newProperty = value | |
| m = new Main | |
| width: 500 | |
| newProperty: "ABC" | |
| # Prints ABC | |
| print m.newProperty |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment