Mixins support for CoffeeScript
npm install -s coffee-mix
Extend this class and call it's static and dynamic helpers as shown below.
require 'coffee-mix'# Class mixinExtension =: -># Method that will be invoked# in class context: -># Instance mixinInclusion =: -># And this one is for instances# prototype context: -># Class and instance mixinConsern =classProperties:: -> @instanceProperties:: -> @# Will be invoked in class context: -># Object mixinIntegration =: -># Method that will be invoked# in instance context: -># Attachable mixinAttachment =# This property will be attached# via setter and getterattachmentMember: "attachment's member"# Will be called in mixin context: -># Will be invoked in instance context:# Bind property helpers to current class= => @get arguments...= => @set arguments...# Define properties@get : -> @_property@set : @_property = property@include Inclusion'Inclusion options'@extend Extension'Extension options'@consern Consern'Consern options':@$attach attachment'Attachment options'@$integrate integration'Integration options'
You can find API docs here.
(The MIT License)
Copyright (C) 2013 Mikhail Zyatin https://github.com/Sitin/ With contributions by several individuals: https://github.com/Sitin/coffee-mix/graphs/contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.