Created
December 15, 2010 16:14
-
-
Save FrozenCanuck/742174 to your computer and use it in GitHub Desktop.
datastore delegate proposal.js
This file contains 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
// Would be placed into frameworks/datastore/mixins folder | |
SC.StoreDelegate = { | |
// Walk like a duck | |
isStoreDelegate: YES, | |
storeRecordWillRefresh(store, status, storeKey) { }; | |
storeRecordDidRefresh(store, status, storeKey) { }; | |
storeRecordWillCommit(store, status, storeKey) { }; | |
storeRecordDidCommit(store, status, storeKey) { }; | |
storeRecordWillDestroy(store, status, storeKey) { }; | |
storeRecordDidDestroy(store, status, storeKey) { }; | |
}; | |
// Would update the store's refreshRecords, commitRecords and destroyRecords | |
// functions to notify the store delegate | |
SC.Store = SC.Object.extend(SC.StoreDelegate, SC.DelegateSupport, { | |
delegate: null, | |
storeDelegate: function() { | |
var del = this.get('delegate'); | |
return this.delegateFor('isStoreDelegate', del); | |
}.property('delegate').cacheable() | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment