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
ff13c102
Commit
ff13c102
authored
Sep 06, 2016
by
chriseth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not pass sources back and forth but retain them.
parent
6b10fccd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
compiler-worker.js
src/app/compiler-worker.js
+1
-1
compiler.js
src/app/compiler.js
+12
-5
No files found.
src/app/compiler-worker.js
View file @
ff13c102
...
...
@@ -34,7 +34,7 @@ module.exports = function (self) {
break
;
case
'compile'
:
missingInputs
.
length
=
0
;
self
.
postMessage
({
cmd
:
'compiled'
,
data
:
compileJSON
(
data
.
source
,
data
.
optimize
),
missingInputs
:
missingInputs
,
source
:
data
.
source
});
self
.
postMessage
({
cmd
:
'compiled'
,
job
:
data
.
job
,
data
:
compileJSON
(
data
.
source
,
data
.
optimize
),
missingInputs
:
missingInputs
});
break
;
}
},
false
);
...
...
src/app/compiler.js
View file @
ff13c102
...
...
@@ -144,7 +144,9 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) {
function
loadInternal
(
url
)
{
delete
window
.
Module
;
// Set a safe fallback until the new one is loaded
setCompileJSON
(
function
(
source
,
optimize
)
{
compilationFinished
({});
});
setCompileJSON
(
function
(
source
,
optimize
)
{
compilationFinished
({
error
:
'Compiler not yet loaded.'
});
});
var
newScript
=
document
.
createElement
(
'script'
);
newScript
.
type
=
'text/javascript'
;
...
...
@@ -164,6 +166,7 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) {
worker
.
terminate
();
}
worker
=
webworkify
(
require
(
'./compiler-worker.js'
));
var
jobs
=
[];
worker
.
addEventListener
(
'message'
,
function
(
msg
)
{
var
data
=
msg
.
data
;
switch
(
data
.
cmd
)
{
...
...
@@ -173,14 +176,17 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) {
break
;
case
'compiled'
:
var
result
;
var
source
;
try
{
result
=
JSON
.
parse
(
data
.
data
);
source
=
JSON
.
parse
(
data
.
source
);
}
catch
(
exception
)
{
result
=
{
'error'
:
'Invalid JSON output from the compiler: '
+
exception
};
}
compilationFinished
(
result
,
data
.
missingInputs
,
source
);
var
sources
=
{};
if
(
data
.
job
in
jobs
!==
undefined
)
{
sources
=
jobs
[
data
.
job
].
sources
;
delete
jobs
[
data
.
job
];
}
compilationFinished
(
result
,
data
.
missingInputs
,
sources
);
break
;
}
});
...
...
@@ -191,7 +197,8 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) {
compilationFinished
({
error
:
'Worker error: '
+
msg
.
data
});
});
compileJSON
=
function
(
source
,
optimize
)
{
worker
.
postMessage
({
cmd
:
'compile'
,
source
:
JSON
.
stringify
(
source
),
optimize
:
optimize
});
jobs
.
push
({
sources
:
source
});
worker
.
postMessage
({
cmd
:
'compile'
,
job
:
jobs
.
length
-
1
,
source
:
JSON
.
stringify
(
source
),
optimize
:
optimize
});
};
worker
.
postMessage
({
cmd
:
'loadVersion'
,
data
:
url
});
}
...
...
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