anderejd / electron-wasm-rust-example Goto Github PK
View Code? Open in Web Editor NEWA minimal Electron + WebAssembly (WASM) + 🦀 Rust example.
License: Apache License 2.0
A minimal Electron + WebAssembly (WASM) + 🦀 Rust example.
License: Apache License 2.0
It would be nice to get rid of this warning:
VM92 security-warnings.js:170 Electron Security Warning (Insecure Content-Security-Policy) This renderer process has either no Content Security
Policy set or a policy with "unsafe-eval" enabled. This exposes users of
this app to unnecessary security risks.
For more information and help, consult
https://electronjs.org/docs/tutorial/security.
This warning will not show up
once the app is packaged.
The cause of this is documented in index.html
:
<!DOCTYPE html>
<html>
<head>
<base href="app://./" />
<!--
'unsafe-eval' is required because of a Chrome bug(?) that disallows
loading WASM from 'self'.
https://github.com/anderejd/electron-wasm-rust-example/issues/6
https://github.com/WebAssembly/content-security-policy/issues/7
https://bugs.chromium.org/p/chromium/issues/detail?id=948834&can=1&q=wasm-eval
-->
<meta http-equiv="Content-Security-Policy" content="script-src 'self' app: 'unsafe-eval'; object-src 'self' app:;">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"/>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<script type="module" src="./main_module.js"></script>
</body>
</html>
Hopefully a future chromium update will allow loading WebAssembly without 'unsafe-eval'.
Electron Deprecation Warning (nodeIntegration default change) This window has node integration enabled by default. In Electron 5.0.0, node integration will be disabled by default. To prepare for this change, set {nodeIntegration: true} in the webPreferences for this window, or ensure that this window does not rely on node integration and set {nodeIntegration: false}.
Electron Deprecation Warning (contextIsolation default change) This window has context isolation disabled by default. In Electron 5.0.0, context isolation will be enabled by default. To prepare for this change, set {contextIsolation: false} in the webPreferences for this window, or ensure that this window does not rely on context isolation being disabled, and set {contextIsolation: true}.
For more information, see https://electronjs.org/docs/tutorial/security#3-enable-context-isolation-for-remote-content
It seems to be the most mature and widely used option for packaging electron, based on github statistics.
Pop_OS 18.10.
app://./wasm/wasm_bi…inimal_example.js:1 Failed to load resource: net::ERR_NOT_IMPLEMENTED
I'm a complete noob, so take a grain of salt.
When npm start
ing, I get:
App threw an error during load
TypeError: protocol.registerStandardSchemes is not a function
at Object.<anonymous> (/home/m/archive/development/rust/distrox/main.js:58:10)
at Module._compile (internal/modules/cjs/loader.js:808:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:820:10)
at Module.load (internal/modules/cjs/loader.js:677:32)
at tryModuleLoad (internal/modules/cjs/loader.js:609:12)
at Function.Module._load (internal/modules/cjs/loader.js:601:3)
at loadApplicationPackage (/nix/store/nd6cx53vcq2ai2l0nlss3qqzl52xfhjk-electron-5.0.0/lib/electron/resources/default_app.asar/main.js:105:12)
at Object.<anonymous> (/nix/store/nd6cx53vcq2ai2l0nlss3qqzl52xfhjk-electron-5.0.0/lib/electron/resources/default_app.asar/main.js:153:5)
at Module._compile (internal/modules/cjs/loader.js:808:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:820:10)
A JavaScript error occurred in the main process
Uncaught Exception:
TypeError: protocol.registerStandardSchemes is not a function
at Object.<anonymous> (/home/m/archive/development/rust/distrox/main.js:58:10)
at Module._compile (internal/modules/cjs/loader.js:808:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:820:10)
at Module.load (internal/modules/cjs/loader.js:677:32)
at tryModuleLoad (internal/modules/cjs/loader.js:609:12)
at Function.Module._load (internal/modules/cjs/loader.js:601:3)
at loadApplicationPackage (/nix/store/nd6cx53vcq2ai2l0nlss3qqzl52xfhjk-electron-5.0.0/lib/electron/resources/default_app.asar/main.js:105:12)
at Object.<anonymous> (/nix/store/nd6cx53vcq2ai2l0nlss3qqzl52xfhjk-electron-5.0.0/lib/electron/resources/default_app.asar/main.js:153:5)
at Module._compile (internal/modules/cjs/loader.js:808:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:820:10)
Fontconfig warning: "/etc/fonts/fonts.conf", line 86: unknown element "blank"
How to call node api and electron api?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.