This repository has been archived by the owner on Dec 29, 2020. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request addresses issue #14 (All options could be given in the constructor). This is my first time working with Coffee Script, so I thought it would be a fun simple issue to take care of. Would love some feedback.
The interesting part is the constructor of slider (https://github.com/mpdaugherty/slider.js/pull/new/master#L5R239). I've moved the properties that people may want to set into a 'defaults' object on the prototype. Then, during initialization, if the user passes in an object with any of the same property names, those properties are set directly on the new Slider.
If the setX() functions were all extremely simple (e.g. set property and return
this
), we could also automatically generate them from the default property object. However, they seem to do extra work when @node is already set, so I decided not to go that far.There are also some other properties like 'transition' that we could probably add to this set of options, and we might want to add the new properties in SliderWithCanvas. I'd like to get your feedback first, however, to make sure these changes match your project; as I mentioned, I haven't done any Coffee Script before, so I'm not really sure if this is idiomatic or not...
To test, I modified demo/index.html to use the new constructor options (https://github.com/mpdaugherty/slider.js/pull/new/master#L1R109). Is there a more complete test suite somewhere?
Finally, my editor automatically removed extra spaces at the end of some lines, so the diff is a little messy. My apologies.