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.

22 lines
587 B

  1. module.exports = Hook
  2. var register = require('./lib/register')
  3. var addHook = require('./lib/add')
  4. var removeHook = require('./lib/remove')
  5. function Hook () {
  6. var state = {
  7. registry: {}
  8. }
  9. var hook = register.bind(null, state)
  10. hook.api = { remove: removeHook.bind(null, state, null) }
  11. hook.remove = removeHook.bind(null, state, null)
  12. ;['before', 'error', 'after', 'wrap'].forEach(function (kind) {
  13. hook[kind] = hook.api[kind] = addHook.bind(null, state, kind)
  14. hook.remove[kind] = hook.api.remove[kind] = removeHook.bind(null, state, kind)
  15. })
  16. return hook
  17. }