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
0d532f00
Commit
0d532f00
authored
Oct 31, 2016
by
Alex Beregszaszi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Save to storage at most every 5 seconds
parent
98fb006d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
app.js
src/app.js
+16
-5
No files found.
src/app.js
View file @
0d532f00
...
@@ -452,20 +452,31 @@ var run = function () {
...
@@ -452,20 +452,31 @@ var run = function () {
var
previousInput
=
''
var
previousInput
=
''
var
compileTimeout
=
null
var
compileTimeout
=
null
var
saveTimeout
=
null
function
editorOnChange
()
{
function
editorOnChange
()
{
var
input
=
editor
.
getValue
()
var
input
=
editor
.
getValue
()
// save contents
editor
.
setCacheFileContent
(
input
)
if
(
input
===
''
)
{
// if there's no change, don't do anything
if
(
input
===
previousInput
)
{
return
return
}
}
previousInput
=
input
if
(
input
===
previousInput
)
{
// fire storage update
// NOTE: save at most once per 5 seconds
if
(
saveTimeout
)
{
window
.
clearTimeout
(
saveTimeout
)
}
saveTimeout
=
window
.
setTimeout
(
function
()
{
var
input
=
editor
.
getValue
()
editor
.
setCacheFileContent
(
input
)
},
5000
)
// special case: there's nothing else to do
if
(
input
===
''
)
{
return
return
}
}
previousInput
=
input
if
(
!
autoCompile
)
{
if
(
!
autoCompile
)
{
return
return
...
...
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