stopPropagation.js 719 B

123456789101112131415161718192021222324
  1. /* eslint-disable
  2. max-len,
  3. */
  4. // TODO: This file was created by bulk-decaffeinate.
  5. // Fix any style issues and re-enable lint.
  6. /*
  7. * decaffeinate suggestions:
  8. * DS102: Remove unnecessary code created because of implicit returns
  9. * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
  10. */
  11. import App from '../base'
  12. App.directive('stopPropagation', $http => ({
  13. restrict: 'A',
  14. link(scope, element, attrs) {
  15. return element.bind(attrs.stopPropagation, e => e.stopPropagation())
  16. },
  17. }))
  18. export default App.directive('preventDefault', $http => ({
  19. restrict: 'A',
  20. link(scope, element, attrs) {
  21. return element.bind(attrs.preventDefault, e => e.preventDefault())
  22. },
  23. }))