Skip to content

mitchlloyd/Spine-Attribute-Events

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spine Attribute Events

Trigger events like "update:name" when attributes are updated.

Using

Extend the module in your spine model.

AttributeTracking = require 'spine_attr_events'

class Document extends Spine.Model
  @configure "Document", "name", "description"
  @extend AttributeTracking

Then you can bind to 'update:name', and 'update:description' events.

class DocumentController extends Spine.Controller
  constructor: ->
    super
    @model.bind 'update:name', -> alert 'name updated!'
    @model.bind 'update:description', -> alert 'description updated!'

Running the Tests

  1. Have mocha installed.
  2. Run mocha in the root of this library.

About

A spine extension to trigger update events for changed attributes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published