Created
August 7, 2013 18:20
-
-
Save teddyzeenny/6176897 to your computer and use it in GitHub Desktop.
Data Adapter API - option 2
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
// Disadvantage: releasing model types will clear all observers | |
// irrespective of how many times getModelTypes was requested | |
// or who made the request | |
getModelTypes: function(target, typesReceived, typeAdded, typeUpdated, typeRemoved) { | |
// code to fetch types ... | |
// ... | |
// call typesReceived and pass fetched types | |
typesReceived.call(target, types); | |
// .. setup array observers to call typeAdded, typeUpdated, and typeRemoved on changes | |
}, | |
releaseModelTypes: function() { | |
//.. code to clear all observers | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment