BinaryFilesManager.js 1.0 KB

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