Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
a44c0884
Commit
a44c0884
authored
Sep 09, 2021
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix unregistering events
parent
cd88483e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
4 deletions
+43
-4
compiler-api.ts
apps/solidity-compiler/src/app/compiler-api.ts
+43
-4
No files found.
apps/solidity-compiler/src/app/compiler-api.ts
View file @
a44c0884
...
...
@@ -45,10 +45,48 @@ export const CompilerApiMixin = (Base) => class extends Base {
}
onActivation
()
{
this
.
listenToEvents
()
this
.
listenToEvents
()
}
onDeactivation
()
{}
onDeactivation
()
{
this
.
off
(
'editor'
,
'contentChanged'
)
if
(
this
.
data
.
eventHandlers
.
onLoadingCompiler
)
{
this
.
compiler
.
event
.
unregister
(
'loadingCompiler'
,
this
.
data
.
eventHandlers
.
onLoadingCompiler
)
}
if
(
this
.
data
.
eventHandlers
.
onCompilerLoaded
)
{
this
.
compiler
.
event
.
unregister
(
'compilerLoaded'
,
this
.
data
.
eventHandlers
.
onCompilerLoaded
)
}
if
(
this
.
data
.
eventHandlers
.
onCompilationFinished
)
{
this
.
compiler
.
event
.
unregister
(
'compilationFinished'
,
this
.
data
.
eventHandlers
.
onCompilationFinished
)
}
this
.
off
(
'filePanel'
,
'setWorkspace'
)
this
.
off
(
'remixd'
,
'rootFolderChanged'
)
this
.
off
(
'editor'
,
'sessionSwitched'
)
if
(
this
.
data
.
eventHandlers
.
onStartingCompilation
)
{
this
.
compileTabLogic
.
event
.
off
(
'startingCompilation'
,
this
.
data
.
eventHandlers
.
onStartingCompilation
)
}
if
(
this
.
data
.
eventHandlers
.
onRemoveAnnotations
)
{
this
.
compileTabLogic
.
event
.
off
(
'removeAnnotations'
,
this
.
data
.
eventHandlers
.
onRemoveAnnotations
)
}
this
.
off
(
'fileManager'
,
'currentFileChanged'
)
this
.
off
(
'fileManager'
,
'noFileSelected'
)
this
.
off
(
'themeModule'
,
'themeChanged'
)
if
(
this
.
data
.
eventHandlers
.
onKeyDown
)
{
window
.
document
.
removeEventListener
(
'keydown'
,
this
.
data
.
eventHandlers
.
onKeyDown
)
}
}
resolveContentAndSave
(
url
)
{
return
this
.
call
(
'contentImport'
,
'resolveAndSave'
,
url
)
...
...
@@ -248,12 +286,13 @@ export const CompilerApiMixin = (Base) => class extends Base {
this
.
on
(
'themeModule'
,
'themeChanged'
,
this
.
data
.
eventHandlers
.
onThemeChanged
)
// Run the compiler instead of trying to save the website
window
.
document
.
addEventListener
(
'keydown'
,
(
e
)
=>
{
this
.
data
.
eventHandlers
.
onKeyDown
=
(
e
)
=>
{
// ctrl+s or command+s
if
((
e
.
metaKey
||
e
.
ctrlKey
)
&&
e
.
keyCode
===
83
)
{
e
.
preventDefault
()
this
.
compileTabLogic
.
runCompiler
(
this
.
getAppParameter
(
'hardhat-compilation'
))
}
})
}
window
.
document
.
addEventListener
(
'keydown'
,
this
.
data
.
eventHandlers
.
onKeyDown
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment