Last active
December 20, 2015 18:38
-
-
Save teddyzeenny/6176786 to your computer and use it in GitHub Desktop.
Data Adapter API - option 1
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
// Advantage: the adapter can be used by multiple tools at the same time and every `getModelTypes` request is isolated. | |
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 | |
var releaseMethod = function() { | |
//.. code to clear all observers | |
} | |
return releaseMethod; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment