From 3abd99c1cd3b229cd1a5abe4bcce0430b92ee049 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 8 Oct 2018 13:35:11 -0400 Subject: [PATCH] move events to their own file as a intermediary step for further refactoring --- src/app.js | 2 +- src/app/debugger/debuggerUI.js | 3 +-- src/app/debugger/debuggerUI/ButtonNavigator.js | 3 +-- src/app/debugger/debuggerUI/Slider.js | 3 +-- src/app/debugger/debuggerUI/StepManager.js | 3 +-- src/app/debugger/debuggerUI/TxBrowser.js | 3 +-- src/app/debugger/debuggerUI/vmDebugger/CodeListView.js | 3 +-- src/app/debugger/debuggerUI/vmDebugger/DropdownPanel.js | 3 +-- src/app/debugger/debuggerUI/vmDebugger/SolidityLocals.js | 3 +-- src/app/editor/contextualListener.js | 2 +- src/app/editor/editor.js | 3 +-- src/app/execution/txLogger.js | 2 +- src/app/files/basicReadOnlyExplorer.js | 2 +- src/app/files/browser-files-tree.js | 2 +- src/app/files/browser-files.js | 2 +- src/app/files/file-explorer.js | 3 +-- src/app/files/fileManager.js | 3 +-- src/app/files/shared-folder.js | 2 +- src/app/panels/editor-panel.js | 3 +-- src/app/panels/file-panel.js | 3 +-- src/app/panels/righthand-panel.js | 3 +-- src/app/panels/terminal.js | 3 +-- src/app/staticanalysis/staticAnalysisView.js | 2 +- src/app/tabs/analysis-tab.js | 3 +-- src/app/tabs/debugger-tab.js | 3 +-- src/app/tabs/plugin-tab.js | 3 +-- src/app/tabs/run-tab.js | 2 +- src/app/tabs/settings-tab.js | 2 +- src/app/tabs/support-tab.js | 3 +-- src/app/tabs/tabbed-menu.js | 3 +-- src/app/ui/TreeView.js | 3 +-- src/app/ui/card.js | 3 +-- src/app/ui/dropdown.js | 4 ++-- src/app/ui/styles-guide/theme-chooser.js | 1 - src/lib/cmdInterpreterAPI.js | 2 +- src/lib/events.js | 4 ++++ src/lib/remixd.js | 2 +- src/recorder.js | 2 +- src/universal-dapp.js | 2 +- 39 files changed, 42 insertions(+), 61 deletions(-) create mode 100644 src/lib/events.js diff --git a/src/app.js b/src/app.js index fe3f6b1c08..773352f089 100644 --- a/src/app.js +++ b/src/app.js @@ -7,7 +7,7 @@ var async = require('async') var request = require('request') var remixLib = require('remix-lib') var remixTests = require('remix-tests') -var EventManager = remixLib.EventManager +var EventManager = require('./lib/events') var registry = require('./global/registry') var UniversalDApp = require('./universal-dapp.js') diff --git a/src/app/debugger/debuggerUI.js b/src/app/debugger/debuggerUI.js index b8e8e535bf..20ab935e33 100644 --- a/src/app/debugger/debuggerUI.js +++ b/src/app/debugger/debuggerUI.js @@ -6,8 +6,7 @@ var Debugger = require('./debugger/debugger') var SourceHighlighter = require('../editor/sourceHighlighter') -var remixLib = require('remix-lib') -var EventManager = remixLib.EventManager +var EventManager = require('../../lib/events') var executionContext = require('../../execution-context') var globalRegistry = require('../../global/registry') diff --git a/src/app/debugger/debuggerUI/ButtonNavigator.js b/src/app/debugger/debuggerUI/ButtonNavigator.js index dd665b31a2..86719dc41b 100644 --- a/src/app/debugger/debuggerUI/ButtonNavigator.js +++ b/src/app/debugger/debuggerUI/ButtonNavigator.js @@ -1,6 +1,5 @@ 'use strict' -var remixLib = require('remix-lib') -var EventManager = remixLib.EventManager +var EventManager = require('../../../lib/events') var yo = require('yo-yo') var csjs = require('csjs-inject') diff --git a/src/app/debugger/debuggerUI/Slider.js b/src/app/debugger/debuggerUI/Slider.js index ddf0dcfbb5..b5b8c2bb6e 100644 --- a/src/app/debugger/debuggerUI/Slider.js +++ b/src/app/debugger/debuggerUI/Slider.js @@ -1,6 +1,5 @@ 'use strict' -var remixLib = require('remix-lib') -var EventManager = remixLib.EventManager +var EventManager = require('../../../lib/events') var yo = require('yo-yo') class Slider { diff --git a/src/app/debugger/debuggerUI/StepManager.js b/src/app/debugger/debuggerUI/StepManager.js index 6c7186871c..db19c48164 100644 --- a/src/app/debugger/debuggerUI/StepManager.js +++ b/src/app/debugger/debuggerUI/StepManager.js @@ -1,5 +1,4 @@ -var remixLib = require('remix-lib') -var EventManager = remixLib.EventManager +var EventManager = require('../../../lib/events') var yo = require('yo-yo') var ButtonNavigator = require('./ButtonNavigator') diff --git a/src/app/debugger/debuggerUI/TxBrowser.js b/src/app/debugger/debuggerUI/TxBrowser.js index 1f4fb2e9fb..382775b1cc 100644 --- a/src/app/debugger/debuggerUI/TxBrowser.js +++ b/src/app/debugger/debuggerUI/TxBrowser.js @@ -1,5 +1,4 @@ -var remixLib = require('remix-lib') -var EventManager = remixLib.EventManager +var EventManager = require('../../../lib/events') var yo = require('yo-yo') var csjs = require('csjs-inject') var styleGuide = require('../../ui/styles-guide/theme-chooser') diff --git a/src/app/debugger/debuggerUI/vmDebugger/CodeListView.js b/src/app/debugger/debuggerUI/vmDebugger/CodeListView.js index 505302cc8a..76f3cc0f34 100644 --- a/src/app/debugger/debuggerUI/vmDebugger/CodeListView.js +++ b/src/app/debugger/debuggerUI/vmDebugger/CodeListView.js @@ -1,9 +1,8 @@ 'use strict' var style = require('../styles/basicStyles') var yo = require('yo-yo') -var remixLib = require('remix-lib') var DropdownPanel = require('./DropdownPanel') -var EventManager = remixLib.EventManager +var EventManager = require('../../../../lib/events') var csjs = require('csjs-inject') var styleGuide = require('../../../ui/styles-guide/theme-chooser') var styles = styleGuide.chooser() diff --git a/src/app/debugger/debuggerUI/vmDebugger/DropdownPanel.js b/src/app/debugger/debuggerUI/vmDebugger/DropdownPanel.js index 2997c6d816..282a5bd34d 100644 --- a/src/app/debugger/debuggerUI/vmDebugger/DropdownPanel.js +++ b/src/app/debugger/debuggerUI/vmDebugger/DropdownPanel.js @@ -1,8 +1,7 @@ 'use strict' var yo = require('yo-yo') const copy = require('clipboard-copy') -var remixLib = require('remix-lib') -var EventManager = remixLib.EventManager +var EventManager = require('../../../../lib/events') var TreeView = require('../../../ui/TreeView') // TODO setup a direct reference to the UI components var csjs = require('csjs-inject') diff --git a/src/app/debugger/debuggerUI/vmDebugger/SolidityLocals.js b/src/app/debugger/debuggerUI/vmDebugger/SolidityLocals.js index c4ca8d956b..e844f55dc0 100644 --- a/src/app/debugger/debuggerUI/vmDebugger/SolidityLocals.js +++ b/src/app/debugger/debuggerUI/vmDebugger/SolidityLocals.js @@ -1,6 +1,5 @@ 'use strict' -var remixLib = require('remix-lib') -var EventManager = remixLib.EventManager +var EventManager = require('../../../../lib/events') var DropdownPanel = require('./DropdownPanel') var solidityTypeFormatter = require('./utils/SolidityTypeFormatter') var yo = require('yo-yo') diff --git a/src/app/editor/contextualListener.js b/src/app/editor/contextualListener.js index 0b6848b3b4..bd7e6e2b46 100644 --- a/src/app/editor/contextualListener.js +++ b/src/app/editor/contextualListener.js @@ -2,7 +2,7 @@ var remixLib = require('remix-lib') var SourceMappingDecoder = remixLib.SourceMappingDecoder var AstWalker = remixLib.AstWalker -var EventManager = remixLib.EventManager +var EventManager = require('../../lib/events') var globalRegistry = require('../../global/registry') /* diff --git a/src/app/editor/editor.js b/src/app/editor/editor.js index 9066ffef3f..e2d27838c4 100644 --- a/src/app/editor/editor.js +++ b/src/app/editor/editor.js @@ -1,6 +1,5 @@ 'use strict' -var remixLib = require('remix-lib') -var EventManager = remixLib.EventManager +var EventManager = require('../../lib/events') var yo = require('yo-yo') var csjs = require('csjs-inject') var ace = require('brace') diff --git a/src/app/execution/txLogger.js b/src/app/execution/txLogger.js index 7558c869a9..bae928b8d8 100644 --- a/src/app/execution/txLogger.js +++ b/src/app/execution/txLogger.js @@ -8,7 +8,7 @@ var remixLib = require('remix-lib') var styleGuide = require('../ui/styles-guide/theme-chooser') var styles = styleGuide.chooser() -var EventManager = remixLib.EventManager +var EventManager = require('../../lib/events') var helper = require('../../lib/helper') var executionContext = require('../../execution-context') var modalDialog = require('../ui/modal-dialog-custom') diff --git a/src/app/files/basicReadOnlyExplorer.js b/src/app/files/basicReadOnlyExplorer.js index 5baf5c790e..df4f17c11c 100644 --- a/src/app/files/basicReadOnlyExplorer.js +++ b/src/app/files/basicReadOnlyExplorer.js @@ -1,5 +1,5 @@ 'use strict' -var EventManager = require('remix-lib').EventManager +var EventManager = require('../../lib/events') class BasicReadOnlyExplorer { constructor (type) { diff --git a/src/app/files/browser-files-tree.js b/src/app/files/browser-files-tree.js index 16ce5a60c2..bc434e0561 100644 --- a/src/app/files/browser-files-tree.js +++ b/src/app/files/browser-files-tree.js @@ -1,6 +1,6 @@ 'use strict' -var EventManager = require('remix-lib').EventManager +var EventManager = require('../../lib/events') function FilesTree (name, storage) { var self = this diff --git a/src/app/files/browser-files.js b/src/app/files/browser-files.js index 8179622f02..de84eb664f 100644 --- a/src/app/files/browser-files.js +++ b/src/app/files/browser-files.js @@ -1,6 +1,6 @@ 'use strict' -var EventManager = require('remix-lib').EventManager +var EventManager = require('../../lib/events') function Files (storage) { var event = new EventManager() diff --git a/src/app/files/file-explorer.js b/src/app/files/file-explorer.js index 730797076c..d0c23595e6 100644 --- a/src/app/files/file-explorer.js +++ b/src/app/files/file-explorer.js @@ -2,8 +2,7 @@ var yo = require('yo-yo') var Treeview = require('../ui/TreeView') var modalDialog = require('../ui/modaldialog') var modalDialogCustom = require('../ui/modal-dialog-custom') -var remixLib = require('remix-lib') -var EventManager = remixLib.EventManager +var EventManager = require('../../lib/events') var contextMenu = require('../ui/contextMenu') var addTooltip = require('../ui/tooltip') var helper = require('../../lib/helper') diff --git a/src/app/files/fileManager.js b/src/app/files/fileManager.js index 5fe8f15846..3cb159bafc 100644 --- a/src/app/files/fileManager.js +++ b/src/app/files/fileManager.js @@ -1,9 +1,8 @@ 'use strict' var $ = require('jquery') -var remixLib = require('remix-lib') var yo = require('yo-yo') -var EventManager = remixLib.EventManager +var EventManager = require('../../lib/events') var globalRegistry = require('../../global/registry') /* diff --git a/src/app/files/shared-folder.js b/src/app/files/shared-folder.js index 98b833a67c..0b712e8c78 100644 --- a/src/app/files/shared-folder.js +++ b/src/app/files/shared-folder.js @@ -1,5 +1,5 @@ 'use strict' -var EventManager = require('remix-lib').EventManager +var EventManager = require('../../lib/events') var pathtool = require('path') module.exports = class SharedFolder { diff --git a/src/app/panels/editor-panel.js b/src/app/panels/editor-panel.js index afe06259f7..7dd62e0d12 100644 --- a/src/app/panels/editor-panel.js +++ b/src/app/panels/editor-panel.js @@ -1,6 +1,5 @@ var yo = require('yo-yo') -var remixLib = require('remix-lib') -var EventManager = remixLib.EventManager +var EventManager = require('../../lib/events') var $ = require('jquery') var Terminal = require('./terminal') diff --git a/src/app/panels/file-panel.js b/src/app/panels/file-panel.js index b6f38b763c..ee3806a74f 100644 --- a/src/app/panels/file-panel.js +++ b/src/app/panels/file-panel.js @@ -3,9 +3,8 @@ var async = require('async') var $ = require('jquery') var yo = require('yo-yo') var CompilerMetadata = require('../files/compiler-metadata') -var remixLib = require('remix-lib') +var EventManager = require('../../lib/events') var Gists = require('gists') -var EventManager = remixLib.EventManager var FileExplorer = require('../files/file-explorer') var modalDialog = require('../ui/modaldialog') var modalDialogCustom = require('../ui/modal-dialog-custom') diff --git a/src/app/panels/righthand-panel.js b/src/app/panels/righthand-panel.js index a6cdc458fc..e81f841108 100644 --- a/src/app/panels/righthand-panel.js +++ b/src/app/panels/righthand-panel.js @@ -1,6 +1,6 @@ const yo = require('yo-yo') const csjs = require('csjs-inject') -const remixLib = require('remix-lib') +const EventManager = require('../../lib/events') var globalRegistry = require('../../global/registry') @@ -17,7 +17,6 @@ const TestTab = require('../tabs/test-tab') const RunTab = require('../tabs/run-tab') const DraggableContent = require('../ui/draggableContent') -const EventManager = remixLib.EventManager const styles = styleguide.chooser() module.exports = class RighthandPanel { diff --git a/src/app/panels/terminal.js b/src/app/panels/terminal.js index a5cb7ea3e7..70e876a355 100644 --- a/src/app/panels/terminal.js +++ b/src/app/panels/terminal.js @@ -5,8 +5,7 @@ var jsbeautify = require('js-beautify') var ethers = require('ethers') var type = require('component-type') var vm = require('vm') -var remixLib = require('remix-lib') -var EventManager = remixLib.EventManager +var EventManager = require('../../lib/events') var Web3 = require('web3') var swarmgw = require('swarmgw')() diff --git a/src/app/staticanalysis/staticAnalysisView.js b/src/app/staticanalysis/staticAnalysisView.js index 9303ea0084..6e9eb28d23 100644 --- a/src/app/staticanalysis/staticAnalysisView.js +++ b/src/app/staticanalysis/staticAnalysisView.js @@ -11,7 +11,7 @@ var styles = styleGuide.chooser() var css = require('./styles/staticAnalysisView-styles') var globlalRegistry = require('../../global/registry') -var EventManager = remixLib.EventManager +var EventManager = require('../../lib/events') function staticAnalysisView (localRegistry) { var self = this diff --git a/src/app/tabs/analysis-tab.js b/src/app/tabs/analysis-tab.js index f7a28c60a8..3a16661ea7 100644 --- a/src/app/tabs/analysis-tab.js +++ b/src/app/tabs/analysis-tab.js @@ -1,10 +1,9 @@ var yo = require('yo-yo') var csjs = require('csjs-inject') -var remixLib = require('remix-lib') var StaticAnalysis = require('../staticanalysis/staticAnalysisView') var globalRegistry = require('../../global/registry') -var EventManager = remixLib.EventManager +var EventManager = require('../../lib/events') module.exports = class AnalysisTab { constructor (localRegistry) { diff --git a/src/app/tabs/debugger-tab.js b/src/app/tabs/debugger-tab.js index fad957216c..94737cec03 100644 --- a/src/app/tabs/debugger-tab.js +++ b/src/app/tabs/debugger-tab.js @@ -1,11 +1,10 @@ var yo = require('yo-yo') var csjs = require('csjs-inject') -var remixLib = require('remix-lib') var DebuggerUI = require('../debugger/debuggerUI') var globalRegistry = require('../../global/registry') -var EventManager = remixLib.EventManager +var EventManager = require('../../lib/events') var styles = require('../ui/styles-guide/theme-chooser').chooser() const css = csjs` diff --git a/src/app/tabs/plugin-tab.js b/src/app/tabs/plugin-tab.js index ae5360792e..0cadf517f4 100644 --- a/src/app/tabs/plugin-tab.js +++ b/src/app/tabs/plugin-tab.js @@ -1,9 +1,8 @@ var yo = require('yo-yo') var csjs = require('csjs-inject') -var remixLib = require('remix-lib') var globalRegistry = require('../../global/registry') -var EventManager = remixLib.EventManager +var EventManager = require('../../lib/events') module.exports = class plugintab { constructor (json, localRegistry) { diff --git a/src/app/tabs/run-tab.js b/src/app/tabs/run-tab.js index 87c54e8c55..03e9f4f1c3 100644 --- a/src/app/tabs/run-tab.js +++ b/src/app/tabs/run-tab.js @@ -7,7 +7,7 @@ var csjs = require('csjs-inject') var txExecution = remixLib.execution.txExecution var txFormat = remixLib.execution.txFormat var txHelper = remixLib.execution.txHelper -var EventManager = remixLib.EventManager +var EventManager = require('../../lib/events') var globlalRegistry = require('../../global/registry') var helper = require('../../lib/helper.js') var executionContext = require('../../execution-context') diff --git a/src/app/tabs/settings-tab.js b/src/app/tabs/settings-tab.js index f17afde956..cb00efc797 100644 --- a/src/app/tabs/settings-tab.js +++ b/src/app/tabs/settings-tab.js @@ -9,7 +9,7 @@ var copyToClipboard = require('../ui/copy-to-clipboard') var styleGuide = require('../ui/styles-guide/theme-chooser') var styles = styleGuide.chooser() var Storage = remixLib.Storage -var EventManager = remixLib.EventManager +var EventManager = require('../../lib/events') module.exports = class SettingsTab { constructor (localRegistry) { diff --git a/src/app/tabs/support-tab.js b/src/app/tabs/support-tab.js index 2db66c79db..ea7367d71a 100644 --- a/src/app/tabs/support-tab.js +++ b/src/app/tabs/support-tab.js @@ -1,11 +1,10 @@ const yo = require('yo-yo') const csjs = require('csjs-inject') -const remixLib = require('remix-lib') var globalRegistry = require('../../global/registry') const styles = require('../ui/styles-guide/theme-chooser').chooser() -const EventManager = remixLib.EventManager +var EventManager = require('../../lib/events') module.exports = class SupportTab { constructor (localRegistry) { diff --git a/src/app/tabs/tabbed-menu.js b/src/app/tabs/tabbed-menu.js index 69a1b2aa5b..52dbf614bb 100644 --- a/src/app/tabs/tabbed-menu.js +++ b/src/app/tabs/tabbed-menu.js @@ -1,12 +1,11 @@ var yo = require('yo-yo') var csjs = require('csjs-inject') -var remixLib = require('remix-lib') var globalRegistry = require('../../global/registry') var helper = require('../../lib/helper') var styles = require('../ui/styles-guide/theme-chooser').chooser() -var EventManager = remixLib.EventManager +var EventManager = require('../../lib/events') module.exports = class TabbedMenu { constructor (localRegistry) { diff --git a/src/app/ui/TreeView.js b/src/app/ui/TreeView.js index 8396a37854..427731140c 100644 --- a/src/app/ui/TreeView.js +++ b/src/app/ui/TreeView.js @@ -29,8 +29,7 @@ var css = csjs` } ` -var remixLib = require('remix-lib') -var EventManager = remixLib.EventManager +var EventManager = require('../../lib/events') /** * TreeView diff --git a/src/app/ui/card.js b/src/app/ui/card.js index 2c372c12f5..c3ca4f259d 100644 --- a/src/app/ui/card.js +++ b/src/app/ui/card.js @@ -2,8 +2,7 @@ var yo = require('yo-yo') var csjs = require('csjs-inject') var styleGuide = require('./styles-guide/theme-chooser') var styles = styleGuide.chooser() -var remixLib = require('remix-lib') -var EventManager = remixLib.EventManager +var EventManager = require('../../lib/events') module.exports = class Card { constructor (api, events, opts) { diff --git a/src/app/ui/dropdown.js b/src/app/ui/dropdown.js index 3afbfc4ff9..6a684962ba 100644 --- a/src/app/ui/dropdown.js +++ b/src/app/ui/dropdown.js @@ -1,6 +1,6 @@ var yo = require('yo-yo') -var remixLib = require('remix-lib') -var EventManager = remixLib.EventManager +var EventManager = require('../../lib/events') + // -------------- styling ---------------------- var css = require('./styles/dropdown-styles') diff --git a/src/app/ui/styles-guide/theme-chooser.js b/src/app/ui/styles-guide/theme-chooser.js index 31060993d9..abcb32ade6 100644 --- a/src/app/ui/styles-guide/theme-chooser.js +++ b/src/app/ui/styles-guide/theme-chooser.js @@ -1,4 +1,3 @@ -// var remixLib = require('remix-lib') var styleGuideLight = require('./style-guide') var styleGuideDark = require('./styleGuideDark') var Storage = require('remix-lib').Storage diff --git a/src/lib/cmdInterpreterAPI.js b/src/lib/cmdInterpreterAPI.js index 5013a23554..0c9b7b6cac 100644 --- a/src/lib/cmdInterpreterAPI.js +++ b/src/lib/cmdInterpreterAPI.js @@ -2,7 +2,7 @@ var yo = require('yo-yo') var async = require('async') var remixLib = require('remix-lib') -var EventManager = remixLib.EventManager +var EventManager = require('../lib/events') var executionContext = require('../execution-context') var toolTip = require('../app/ui/tooltip') diff --git a/src/lib/events.js b/src/lib/events.js new file mode 100644 index 0000000000..882da1893a --- /dev/null +++ b/src/lib/events.js @@ -0,0 +1,4 @@ +var remixLib = require('remix-lib') +var EventManager = remixLib.EventManager + +module.exports = EventManager diff --git a/src/lib/remixd.js b/src/lib/remixd.js index 47e92582e2..8fc1b82f05 100644 --- a/src/lib/remixd.js +++ b/src/lib/remixd.js @@ -1,5 +1,5 @@ 'use strict' -var EventManager = require('remix-lib').EventManager +var EventManager = require('../lib/events') var modalDialog = require('../app/ui/modaldialog') var yo = require('yo-yo') diff --git a/src/recorder.js b/src/recorder.js index 030ae9cbb7..32ac7b648e 100644 --- a/src/recorder.js +++ b/src/recorder.js @@ -1,5 +1,5 @@ var remixLib = require('remix-lib') -var EventManager = remixLib.EventManager +var EventManager = require('./lib/events') var ethutil = require('ethereumjs-util') var executionContext = require('./execution-context') var format = remixLib.execution.txFormat diff --git a/src/universal-dapp.js b/src/universal-dapp.js index ee595c079c..66c98fef19 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -6,7 +6,7 @@ var async = require('async') var ethJSUtil = require('ethereumjs-util') var BN = ethJSUtil.BN var remixLib = require('remix-lib') -var EventManager = remixLib.EventManager +var EventManager = require('./lib/events') var crypto = require('crypto') var TxRunner = remixLib.execution.txRunner var txExecution = remixLib.execution.txExecution