BinaryFilesManager.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /* eslint-disable
  2. max-len,
  3. no-undef,
  4. no-unused-vars,
  5. */
  6. // TODO: This file was created by bulk-decaffeinate.
  7. // Fix any style issues and re-enable lint.
  8. /*
  9. * decaffeinate suggestions:
  10. * DS102: Remove unnecessary code created because of implicit returns
  11. * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
  12. */
  13. define(['ide/binary-files/controllers/BinaryFileController'], function() {
  14. let BinaryFilesManager
  15. return (BinaryFilesManager = class BinaryFilesManager {
  16. constructor(ide, $scope) {
  17. this.ide = ide
  18. this.$scope = $scope
  19. this.$scope.$on('entity:selected', (event, entity) => {
  20. if (this.$scope.ui.view !== 'track-changes' && entity.type === 'file') {
  21. return this.openFile(entity)
  22. }
  23. })
  24. }
  25. openFile(file) {
  26. this.ide.fileTreeManager.selectEntity(file)
  27. this.$scope.ui.view = 'file'
  28. this.$scope.openFile = null
  29. this.$scope.$apply()
  30. return window.setTimeout(
  31. () => {
  32. this.$scope.openFile = file
  33. return this.$scope.$apply()
  34. },
  35. 0,
  36. this
  37. )
  38. }
  39. })
  40. })