Simple email application for Android. Original source code: https://framagit.org/dystopia-project/simple-email
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
408 B

  1. "use strict"
  2. var next = (global.process && process.nextTick) || global.setImmediate || function (f) {
  3. setTimeout(f, 0)
  4. }
  5. module.exports = function maybe (cb, promise) {
  6. if (cb) {
  7. promise
  8. .then(function (result) {
  9. next(function () { cb(null, result) })
  10. }, function (err) {
  11. next(function () { cb(err) })
  12. })
  13. return undefined
  14. }
  15. else {
  16. return promise
  17. }
  18. }