Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pyodide
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
pyodide
Commits
e1fb1b96
Commit
e1fb1b96
authored
Jan 31, 2019
by
Jason Stafford
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a generic webworker file
parent
8e8ac26b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletion
+27
-1
Makefile
Makefile
+4
-1
src/webworker.js
src/webworker.js
+23
-0
No files found.
Makefile
View file @
e1fb1b96
...
...
@@ -57,7 +57,8 @@ all: build/pyodide.asm.js \
build/renderedhtml.css
\
build/test.data
\
build/packages.json
\
build/test.html
build/test.html
\
build/webworker.js
build/pyodide.asm.js
:
src/main.bc src/jsimport.bc src/jsproxy.bc src/js2python.bc
\
...
...
@@ -112,6 +113,8 @@ build/test.html: src/test.html
build/renderedhtml.css
:
src/renderedhtml.less
lessc
$<
$@
build/webworker.js
:
src/webworker.js
cp
$<
$@
test
:
all
pytest
test
/
-v
...
...
src/webworker.js
0 → 100644
View file @
e1fb1b96
importScripts
(
'
./pyodide.js
'
)
var
onmessage
=
function
(
e
)
{
// eslint-disable-line no-unused-vars
languagePluginLoader
.
then
(()
=>
{
const
data
=
e
.
data
;
const
keys
=
Object
.
keys
(
data
);
for
(
let
key
of
keys
)
{
if
(
key
!==
'
python
'
)
{
// Keys other than python must be arguments for the python script.
// Set them on self, so that `from js import key` works.
self
[
key
]
=
data
[
key
];
}
}
self
.
pyodide
.
runPythonAsync
(
data
.
python
,
()
=>
{}).
then
((
results
)
=>
{
self
.
postMessage
({
results
});
}).
catch
((
err
)
=>
{
// if you prefer messages with the error
self
.
postMessage
({
error
:
err
.
message
});
// if you prefer onerror events
// setTimeout(() => { throw err; });
});
});
}
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