Skip to content

Instantly share code, notes, and snippets.

@davidascher
Created March 1, 2013 22:27
Show Gist options
  • Save davidascher/5068431 to your computer and use it in GitHub Desktop.
Save davidascher/5068431 to your computer and use it in GitHub Desktop.
// the meteor framework expects calls to be sync:
Meteor.methods({
search: function (term) {
return searchresults;
}
});
// the db call that performs the search is async:
db.run("SELECT key FROM paragraphs WHERE data MATCH '" + term + "'", function(err, rows) {
searchresults = rows;
});
@davidascher
Copy link
Author

var fut = new Future();
db.all("SELECT key FROM paragraphs WHERE data MATCH '" + term + "';";, function(err, rows) {
    fut.ret(rows);
})
return fut.wait();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment