codebrew / backbone-rails

Easily use backbone.js with rails 3.1
MIT License
1.62k stars 255 forks source link

Trigger sync:start, sync:end events #60

Closed dnagir closed 12 years ago

dnagir commented 12 years ago

This allows binding directly to the model:

@model.bind 'sync:start', @showNotification
@model.bind 'sync:end', @hideNotification
codebrew commented 12 years ago

I like it, gives people a simple and obvious way to hook into the sync.

A couple comments:

model.trigger('sync:start') should happen inside the beforeSend method. model.trigger('sync:end') should probably be in a complete method, jquery calls complete after the error and success callbacks.

codebrew commented 12 years ago

I added in sync events with commit f16dad1082

Let me know if you run into any issues with it.

dnagir commented 12 years ago

Thanks. Much better commit.