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
7e583735
Commit
7e583735
authored
May 18, 2018
by
serapath
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CompileTab: re-group event listeners
parent
ae6e4743
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
32 deletions
+24
-32
compile-tab.js
src/app/tabs/compile-tab.js
+24
-32
No files found.
src/app/tabs/compile-tab.js
View file @
7e583735
...
@@ -47,26 +47,6 @@ class CompileTab {
...
@@ -47,26 +47,6 @@ class CompileTab {
})
})
var
compileTimeout
=
null
var
compileTimeout
=
null
function
scheduleCompilation
()
{
if
(
!
opts
.
config
.
get
(
'autoCompile'
))
{
return
}
if
(
compileTimeout
)
{
window
.
clearTimeout
(
compileTimeout
)
}
compileTimeout
=
window
.
setTimeout
(()
=>
{
appAPI
.
runCompiler
()
},
300
)
}
appEvents
.
editor
.
register
(
'contentChanged'
,
()
=>
{
scheduleCompilation
()
})
appEvents
.
editor
.
register
(
'sessionSwitched'
,
()
=>
{
scheduleCompilation
()
})
// ----------------- autoCompile -----------------
// ----------------- autoCompile -----------------
var
autoCompileInput
=
compileContainer
.
querySelector
(
'#autoCompile'
)
var
autoCompileInput
=
compileContainer
.
querySelector
(
'#autoCompile'
)
...
@@ -83,9 +63,24 @@ class CompileTab {
...
@@ -83,9 +63,24 @@ class CompileTab {
opts
.
config
.
set
(
'autoCompile'
,
autoCompileInput
.
checked
)
opts
.
config
.
set
(
'autoCompile'
,
autoCompileInput
.
checked
)
})
})
// REGISTER EVENTS
appEvents
.
editor
.
register
(
'contentChanged'
,
()
=>
{
scheduleCompilation
()
})
appEvents
.
editor
.
register
(
'sessionSwitched'
,
()
=>
{
scheduleCompilation
()
})
function
scheduleCompilation
()
{
if
(
!
opts
.
config
.
get
(
'autoCompile'
))
{
return
}
// compilationDuration
if
(
compileTimeout
)
{
window
.
clearTimeout
(
compileTimeout
)
}
compileTimeout
=
window
.
setTimeout
(()
=>
{
appAPI
.
runCompiler
()
},
300
)
}
appEvents
.
compiler
.
register
(
'compilationDuration'
,
function
tabHighlighting
(
speed
)
{
appEvents
.
compiler
.
register
(
'compilationDuration'
,
function
tabHighlighting
(
speed
)
{
if
(
speed
>
1000
)
{
if
(
speed
>
1000
)
{
warnCompilationSlow
.
setAttribute
(
'title'
,
`Last compilation took
${
speed
}
ms. We suggest to turn off autocompilation.`
)
warnCompilationSlow
.
setAttribute
(
'title'
,
`Last compilation took
${
speed
}
ms. We suggest to turn off autocompilation.`
)
...
@@ -94,7 +89,6 @@ class CompileTab {
...
@@ -94,7 +89,6 @@ class CompileTab {
warnCompilationSlow
.
style
.
display
=
'none'
warnCompilationSlow
.
style
.
display
=
'none'
}
}
})
})
// loadingCompiler
appEvents
.
editor
.
register
(
'contentChanged'
,
function
changedFile
()
{
appEvents
.
editor
.
register
(
'contentChanged'
,
function
changedFile
()
{
var
compileTab
=
document
.
querySelector
(
'.compileView'
)
var
compileTab
=
document
.
querySelector
(
'.compileView'
)
compileTab
.
style
.
color
=
styles
.
colors
.
red
compileTab
.
style
.
color
=
styles
.
colors
.
red
...
@@ -123,14 +117,6 @@ class CompileTab {
...
@@ -123,14 +117,6 @@ class CompileTab {
compileIcon
.
classList
.
remove
(
`
${
css
.
spinningIcon
}
`
)
compileIcon
.
classList
.
remove
(
`
${
css
.
spinningIcon
}
`
)
compileIcon
.
setAttribute
(
'title'
,
''
)
compileIcon
.
setAttribute
(
'title'
,
''
)
})
})
var
errorContainer
=
yo
`<div class='error'></div>`
/* ------------------------------------------------
section CONTRACT DROPDOWN, DETAILS AND PUBLISH
------------------------------------------------ */
var
contractsDetails
=
{}
appEvents
.
compiler
.
register
(
'compilationFinished'
,
function
(
success
,
data
,
source
)
{
appEvents
.
compiler
.
register
(
'compilationFinished'
,
function
(
success
,
data
,
source
)
{
// reset the contractMetadata list (used by the publish action)
// reset the contractMetadata list (used by the publish action)
contractsDetails
=
{}
contractsDetails
=
{}
...
@@ -162,7 +148,6 @@ class CompileTab {
...
@@ -162,7 +148,6 @@ class CompileTab {
}
}
}
}
})
})
appEvents
.
staticAnalysis
.
register
(
'staticAnaysisWarning'
,
(
count
)
=>
{
appEvents
.
staticAnalysis
.
register
(
'staticAnaysisWarning'
,
(
count
)
=>
{
if
(
count
)
{
if
(
count
)
{
opts
.
renderer
.
error
(
`Static Analysis raised
${
count
}
warning(s) that requires your attention.`
,
$
(
errorContainer
),
{
opts
.
renderer
.
error
(
`Static Analysis raised
${
count
}
warning(s) that requires your attention.`
,
$
(
errorContainer
),
{
...
@@ -172,6 +157,13 @@ class CompileTab {
...
@@ -172,6 +157,13 @@ class CompileTab {
}
}
})
})
var
errorContainer
=
yo
`<div class='error'></div>`
/* ------------------------------------------------
section CONTRACT DROPDOWN, DETAILS AND PUBLISH
------------------------------------------------ */
var
contractsDetails
=
{}
var
contractEl
=
yo
`
var
contractEl
=
yo
`
<div class="
${
css
.
container
}
">
<div class="
${
css
.
container
}
">
<select class="
${
css
.
contractNames
}
" disabled></select>
<select class="
${
css
.
contractNames
}
" disabled></select>
...
...
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