Last active
January 1, 2018 22:50
-
-
Save eriadam/d2ad797906c9f5de3078aeef1c1f3080 to your computer and use it in GitHub Desktop.
Rx Observable Function Call
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
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