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
54a13b3e
Commit
54a13b3e
authored
Aug 24, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move autoCompile option to compile-tab && move runCompiler timeout to compile-tab
parent
26023051
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
31 deletions
+42
-31
app.js
src/app.js
+3
-31
compile-tab.js
src/app/tabs/compile-tab.js
+39
-0
No files found.
src/app.js
View file @
54a13b3e
...
@@ -601,6 +601,9 @@ function run () {
...
@@ -601,6 +601,9 @@ function run () {
},
},
loadCompiler
:
(
usingWorker
,
url
)
=>
{
loadCompiler
:
(
usingWorker
,
url
)
=>
{
compiler
.
loadVersion
(
usingWorker
,
url
)
compiler
.
loadVersion
(
usingWorker
,
url
)
},
runCompiler
:
()
=>
{
runCompiler
()
}
}
}
}
var
rhpEvents
=
{
var
rhpEvents
=
{
...
@@ -858,18 +861,6 @@ function run () {
...
@@ -858,18 +861,6 @@ function run () {
startdebugging
(
hash
)
startdebugging
(
hash
)
})
})
// ----------------- autoCompile -----------------
var
autoCompile
=
document
.
querySelector
(
'#autoCompile'
).
checked
if
(
config
.
exists
(
'autoCompile'
))
{
autoCompile
=
config
.
get
(
'autoCompile'
)
$
(
'#autoCompile'
).
checked
=
autoCompile
}
document
.
querySelector
(
'#autoCompile'
).
addEventListener
(
'change'
,
function
()
{
autoCompile
=
document
.
querySelector
(
'#autoCompile'
).
checked
config
.
set
(
'autoCompile'
,
autoCompile
)
})
function
runCompiler
()
{
function
runCompiler
()
{
if
(
transactionDebugger
.
isActive
)
return
if
(
transactionDebugger
.
isActive
)
return
...
@@ -908,7 +899,6 @@ function run () {
...
@@ -908,7 +899,6 @@ function run () {
}
}
var
previousInput
=
''
var
previousInput
=
''
var
compileTimeout
=
null
var
saveTimeout
=
null
var
saveTimeout
=
null
function
editorOnChange
()
{
function
editorOnChange
()
{
...
@@ -930,30 +920,12 @@ function run () {
...
@@ -930,30 +920,12 @@ function run () {
window
.
clearTimeout
(
saveTimeout
)
window
.
clearTimeout
(
saveTimeout
)
}
}
saveTimeout
=
window
.
setTimeout
(
editorSyncFile
,
5000
)
saveTimeout
=
window
.
setTimeout
(
editorSyncFile
,
5000
)
// special case: there's nothing else to do
if
(
input
===
''
)
{
return
}
if
(
!
autoCompile
)
{
return
}
if
(
compileTimeout
)
{
window
.
clearTimeout
(
compileTimeout
)
}
compileTimeout
=
window
.
setTimeout
(
runCompiler
,
300
)
}
}
editor
.
event
.
register
(
'contentChanged'
,
editorOnChange
)
editor
.
event
.
register
(
'contentChanged'
,
editorOnChange
)
// in order to save the file when switching
// in order to save the file when switching
editor
.
event
.
register
(
'sessionSwitched'
,
editorOnChange
)
editor
.
event
.
register
(
'sessionSwitched'
,
editorOnChange
)
$
(
'#compile'
).
click
(
function
()
{
runCompiler
()
})
executionContext
.
event
.
register
(
'contextChanged'
,
this
,
function
(
context
)
{
executionContext
.
event
.
register
(
'contextChanged'
,
this
,
function
(
context
)
{
runCompiler
()
runCompiler
()
})
})
...
...
src/app/tabs/compile-tab.js
View file @
54a13b3e
...
@@ -155,6 +155,45 @@ function compileTab (container, appAPI, appEvents, opts) {
...
@@ -155,6 +155,45 @@ function compileTab (container, appAPI, appEvents, opts) {
</div>
</div>
`
`
compileContainer
.
querySelector
(
'#compile'
).
addEventListener
(
'click'
,
()
=>
{
appAPI
.
runCompiler
()
})
var
compileTimeout
=
null
function
scheduleCompilation
()
{
if
(
!
appAPI
.
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 -----------------
var
autoCompileInput
=
compileContainer
.
querySelector
(
'#autoCompile'
)
if
(
appAPI
.
config
.
exists
(
'autoCompile'
))
{
var
autoCompile
=
appAPI
.
config
.
get
(
'autoCompile'
)
if
(
autoCompile
)
{
autoCompileInput
.
setAttribute
(
'checked'
,
autoCompile
)
}
}
autoCompileInput
.
addEventListener
(
'change'
,
function
()
{
appAPI
.
config
.
set
(
'autoCompile'
,
autoCompileInput
.
checked
)
})
// REGISTER EVENTS
// REGISTER EVENTS
// compilationDuration
// compilationDuration
...
...
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