Skip to content

Instantly share code, notes, and snippets.

@eriadam
Last active January 1, 2018 22:50
Show Gist options
  • Save eriadam/d2ad797906c9f5de3078aeef1c1f3080 to your computer and use it in GitHub Desktop.
Save eriadam/d2ad797906c9f5de3078aeef1c1f3080 to your computer and use it in GitHub Desktop.
Rx Observable Function Call
function fetchDataFromDatabase(query) {
// Calling iOS method here
Rx
.Observable
.create(function subscribe(observer) {
// This will be called by the iOS client
didReceiveDataFromDatabase = function(data) {
// Parse, process your data if needed.
observer.next(JSON.parse(data));
}
})
.subscribe(result => {
// Receiving data here
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment