react-native-db-models
react-native-db-models copied to clipboard
make api node style
By making callback node style, the first argument of callback is error
, users can use something like bluebird.promisify
to convert the callback style to the promise style.
This is a good change but it might be a breaking change for many. I am kind of involved with some other stuff these days will merge it soon. untill then you can fix/ make sure it doesn't break the current applications
It's been two years and this hasn't been merged. For anyone coming to this who only knows how to promisify using Bluebird or another third-party promisify function, here's how you do it with the add function as an example:
function myAdd(item) {
return new Promise(resolve => db.add(item, result => resolve(result)))
}
myAdd will now return a promise that resolves to what db inserted.