mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-24 18:43:33 +03:00
Applied eslint from main .eslintrc to examples (#418)
* Changed eslintrc to be JSON file (Most projects use JSON version) * Added .eslintignore to ingore node_modules from subdirectories such as examples * Ran eslint --fix examples to fix all examples * Added npm script for running eslint against examples * Added npm script for running eslint against generated *out* code * Hooked npm scripts into travis ci to prevent examples from becoming inconsistent with future PR's
This commit is contained in:
parent
9482a1fa9a
commit
6561fba947
1
.eslintignore
Normal file
1
.eslintignore
Normal file
@ -0,0 +1 @@
|
||||
node_modules
|
34
.eslintrc
Normal file
34
.eslintrc
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"env": {
|
||||
"es6": true,
|
||||
"browser": true,
|
||||
"commonjs": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"parser": "babel-eslint",
|
||||
"parserOptions": {
|
||||
"sourceType": "module"
|
||||
},
|
||||
"rules": {
|
||||
"indent": ["error", 4],
|
||||
"linebreak-style": [
|
||||
"error",
|
||||
"unix"
|
||||
],
|
||||
"quotes": [
|
||||
"error",
|
||||
"single"
|
||||
],
|
||||
"semi": [
|
||||
"error",
|
||||
"always"
|
||||
],
|
||||
"no-console": 0,
|
||||
"no-undef": "warn"
|
||||
},
|
||||
"globals": {
|
||||
"BigInt64Array": true,
|
||||
"BigUint64Array": true
|
||||
}
|
||||
}
|
34
.eslintrc.js
34
.eslintrc.js
@ -1,34 +0,0 @@
|
||||
module.exports = {
|
||||
env: {
|
||||
es6: true,
|
||||
browser: true,
|
||||
commonjs: true,
|
||||
node: true
|
||||
},
|
||||
extends: 'eslint:recommended',
|
||||
parser: 'babel-eslint',
|
||||
parserOptions: {
|
||||
sourceType: 'module'
|
||||
},
|
||||
rules: {
|
||||
indent: ['error', 4],
|
||||
'linebreak-style': [
|
||||
'error',
|
||||
'unix'
|
||||
],
|
||||
quotes: [
|
||||
'error',
|
||||
'single'
|
||||
],
|
||||
semi: [
|
||||
'error',
|
||||
'always'
|
||||
],
|
||||
'no-console': 0,
|
||||
'no-undef': 'warn'
|
||||
},
|
||||
globals: {
|
||||
BigInt64Array: true,
|
||||
BigUint64Array: true
|
||||
}
|
||||
};
|
@ -40,7 +40,9 @@ matrix:
|
||||
script:
|
||||
- cargo test
|
||||
# Check JS output from all tests against eslint
|
||||
- ./node_modules/.bin/eslint ./target/generated-tests/*/out*js
|
||||
- npm run run-lint-generated-tests
|
||||
# Check Examples against eslint
|
||||
- npm run run-lint-examples
|
||||
addons:
|
||||
firefox: latest
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// For more comments about what's going on here, check out the `hello_world`
|
||||
// example
|
||||
const rust = import("./add");
|
||||
const rust = import('./add');
|
||||
rust.then(m => alert('1 + 2 = ' + m.add(1, 2)));
|
||||
|
@ -1,10 +1,10 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
entry: "./index.js",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "dist"),
|
||||
filename: "index.js",
|
||||
},
|
||||
mode: "development"
|
||||
entry: './index.js',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'index.js',
|
||||
},
|
||||
mode: 'development'
|
||||
};
|
||||
|
@ -1,10 +1,10 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
entry: "./index.js",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "dist"),
|
||||
filename: "index.js",
|
||||
},
|
||||
mode: "development"
|
||||
entry: './index.js',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'index.js',
|
||||
},
|
||||
mode: 'development'
|
||||
};
|
||||
|
@ -1,85 +1,86 @@
|
||||
export let chars = [
|
||||
"!","#","$","%","&","'","(",")","*","+",",",
|
||||
"-",".","/","0","1","2","3","4","5","6","7",
|
||||
"8","9",":",";","<","=",">","?","@","A","B",
|
||||
"C","D","E","F","G","H","I","J","K","L","M",
|
||||
"N","O","P","Q","R","S","T","U","V","W","X",
|
||||
"Y","Z","[","]","^","_","`","a","b","c",
|
||||
"d","e","f","g","h","i","j","k","l","m","n",
|
||||
"o","p","q","r","s","t","u","v","w","x","y",
|
||||
"z","{","|","}","~"," ","¡","¢","£","¤","¥",
|
||||
"¦","§","¨","©","ª","«","¬","®","¯","°",
|
||||
"±","²","³","´","µ","¶","·","¸","¹","º","»",
|
||||
"¼","½","¾","¿","À","Á","Â","Ã","Ä","Å","Æ",
|
||||
"Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ",
|
||||
"Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û","Ü",
|
||||
"Ý","Þ","ß","à","á","â","ã","ä","å","æ","ç",
|
||||
"è","é","ê","ë","ì","í","î","ï","ð","ñ","ò",
|
||||
"ó","ô","õ","ö","÷","ø","ù","ú","û","ü","ý",
|
||||
"þ","ÿ","Ā","ā","Ă","ă","Ą","ą","Ć","ć","Ĉ",
|
||||
"ĉ","Ċ","ċ","Č","č","Ď","ď","Đ","đ","Ē","ē",
|
||||
"Ĕ","ĕ","Ė","ė","Ę","ę","Ě","ě","Ĝ","ĝ","Ğ",
|
||||
"ğ","Ġ","ġ","Ģ","ģ","Ĥ","ĥ","Ħ","ħ","Ĩ","ĩ",
|
||||
"Ī","ī","Ĭ","ĭ","Į","į","İ","ı","IJ","ij","Ĵ",
|
||||
"ĵ","Ķ","ķ","ĸ","Ĺ","ĺ","Ļ","ļ","Ľ","ľ","Ŀ",
|
||||
"ŀ","Ł","ł","Ń","ń","Ņ","ņ","Ň","ň","ʼn","Ŋ",
|
||||
"ŋ","Ō","ō","Ŏ","ŏ","Ő","ő","Œ","œ","Ŕ","ŕ",
|
||||
"Ŗ","ŗ","Ř","ř","Ś","ś","Ŝ","ŝ","Ş","ş","Š",
|
||||
"š","Ţ","ţ","Ť","ť","Ŧ","ŧ","Ũ","ũ","Ū","ū",
|
||||
"Ŭ","ŭ","Ů","ů","Ű","ű","Ų","ų","Ŵ","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
|
||||
"Χ","Ψ","Ω","Ϊ","Ϋ","ά","έ","ή","ί","ΰ","α",
|
||||
"β","γ","δ","ε","ζ","η","θ","ι","κ","λ","μ",
|
||||
"ν","ξ","ο","π","ρ","ς","σ","τ","υ","φ","χ",
|
||||
"ψ","ω","ϊ","ϋ","ό","ύ","ώ","Ϗ","ϐ","ϑ","ϒ",
|
||||
"ϓ","ϔ","ϕ","ϖ","ϗ","Ϙ","ϙ","Ϛ","ϛ","Ϝ","ϝ",
|
||||
"Ϟ","ϟ","Ϡ","ϡ","Ϣ","ϣ","Ϥ","ϥ","Ϧ","ϧ","Ϩ",
|
||||
"ϩ","Ϫ","ϫ","Ϭ","ϭ","Ϯ","ϯ","ϰ","ϱ","ϲ","ϳ",
|
||||
"Օ","Ֆ","🕧","🕨","🕩","🕪","🕫","🕬","🕭","🕮",
|
||||
"🕯","🕰","🕱","🕲","🕳","🕴","🕵","🕶","🕷","🕸",
|
||||
"🕹","🕺","🕻","🕼","🕽","🕾","🕿","🖀","🖁","🖂",
|
||||
"🖃","🖄","🖅","🖆","🖇","🖈","🖉","🖊","🖋",
|
||||
"🖌","🖍","🖎","🖏","🖐","🖑","🖒","🖓","🖔","🖕",
|
||||
"🖖","🖗","🖘","🖙","🖚","🖛","🖜","🖝","🖞","🖟",
|
||||
"🖠","🖡","🖢","🖣","🖤","🖥","🖦","🖧","🖨","🖩",
|
||||
"🖪","🖫","🖬","🖭","🖮","🖯","🖰","🖱","🖲","🖳",
|
||||
"🖴","🖵","🖶","🖷","🖸","🖹","🖺","🖻","🖼","🖽",
|
||||
"🖾","🖿","🗀","🗁","🗂","🗃","🗄","🗅","🗆","🗇",
|
||||
"🗈","🗉","🗊","🗋","🗌","🗍","🗎","🗏","🗐","🗑","🗒",
|
||||
"🗓","🗔","🗕","🗖","🗗","🗘","🗙","🗚","🗛","🗜",
|
||||
"🗝","🗞","🗟","🗠","🗡","🗢","🗣","🗤","🗥","🗦",
|
||||
"🗧","🗨","🗩","🗪","🗫","🗬","🗭","🗮","🗯","🗰",
|
||||
"🗱","🗲","🗳","🗴","🗵","🗶","🗷","🗸","🗹","🗺",
|
||||
"🗻","🗼","🗽","🗾","🗿","😀"];
|
||||
'!','#','$','%','&','\'','(',')','*','+',',',
|
||||
'-','.','/','0','1','2','3','4','5','6','7',
|
||||
'8','9',':',';','<','=','>','?','@','A','B',
|
||||
'C','D','E','F','G','H','I','J','K','L','M',
|
||||
'N','O','P','Q','R','S','T','U','V','W','X',
|
||||
'Y','Z','[',']','^','_','`','a','b','c',
|
||||
'd','e','f','g','h','i','j','k','l','m','n',
|
||||
'o','p','q','r','s','t','u','v','w','x','y',
|
||||
'z','{','|','}','~',' ','¡','¢','£','¤','¥',
|
||||
'¦','§','¨','©','ª','«','¬','®','¯','°',
|
||||
'±','²','³','´','µ','¶','·','¸','¹','º','»',
|
||||
'¼','½','¾','¿','À','Á','Â','Ã','Ä','Å','Æ',
|
||||
'Ç','È','É','Ê','Ë','Ì','Í','Î','Ï','Ð','Ñ',
|
||||
'Ò','Ó','Ô','Õ','Ö','×','Ø','Ù','Ú','Û','Ü',
|
||||
'Ý','Þ','ß','à','á','â','ã','ä','å','æ','ç',
|
||||
'è','é','ê','ë','ì','í','î','ï','ð','ñ','ò',
|
||||
'ó','ô','õ','ö','÷','ø','ù','ú','û','ü','ý',
|
||||
'þ','ÿ','Ā','ā','Ă','ă','Ą','ą','Ć','ć','Ĉ',
|
||||
'ĉ','Ċ','ċ','Č','č','Ď','ď','Đ','đ','Ē','ē',
|
||||
'Ĕ','ĕ','Ė','ė','Ę','ę','Ě','ě','Ĝ','ĝ','Ğ',
|
||||
'ğ','Ġ','ġ','Ģ','ģ','Ĥ','ĥ','Ħ','ħ','Ĩ','ĩ',
|
||||
'Ī','ī','Ĭ','ĭ','Į','į','İ','ı','IJ','ij','Ĵ',
|
||||
'ĵ','Ķ','ķ','ĸ','Ĺ','ĺ','Ļ','ļ','Ľ','ľ','Ŀ',
|
||||
'ŀ','Ł','ł','Ń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'ʫ','ʬ','ʭ','ʮ','ʯ','Ͳ','ͳ','ʹ','͵','Ͷ','ͷ',
|
||||
'ͺ','ͻ','ͼ','ͽ',';','Ϳ','΄','΅','Ά','·','Έ','Ή',
|
||||
'Ί','Ό','Ύ','Ώ',
|
||||
'ΐ','Α','Β','Γ','Δ','Ε','Ζ','Η','Θ','Ι','Κ',
|
||||
'Λ','Μ','Ν','Ξ','Ο','Π','Ρ','Σ','Τ','Υ','Φ',
|
||||
'Χ','Ψ','Ω','Ϊ','Ϋ','ά','έ','ή','ί','ΰ','α',
|
||||
'β','γ','δ','ε','ζ','η','θ','ι','κ','λ','μ',
|
||||
'ν','ξ','ο','π','ρ','ς','σ','τ','υ','φ','χ',
|
||||
'ψ','ω','ϊ','ϋ','ό','ύ','ώ','Ϗ','ϐ','ϑ','ϒ',
|
||||
'ϓ','ϔ','ϕ','ϖ','ϗ','Ϙ','ϙ','Ϛ','ϛ','Ϝ','ϝ',
|
||||
'Ϟ','ϟ','Ϡ','ϡ','Ϣ','ϣ','Ϥ','ϥ','Ϧ','ϧ','Ϩ',
|
||||
'ϩ','Ϫ','ϫ','Ϭ','ϭ','Ϯ','ϯ','ϰ','ϱ','ϲ','ϳ',
|
||||
'Օ','Ֆ','🕧','🕨','🕩','🕪','🕫','🕬','🕭','🕮',
|
||||
'🕯','🕰','🕱','🕲','🕳','🕴','🕵','🕶','🕷','🕸',
|
||||
'🕹','🕺','🕻','🕼','🕽','🕾','🕿','🖀','🖁','🖂',
|
||||
'🖃','🖄','🖅','🖆','🖇','🖈','🖉','🖊','🖋',
|
||||
'🖌','🖍','🖎','🖏','🖐','🖑','🖒','🖓','🖔','🖕',
|
||||
'🖖','🖗','🖘','🖙','🖚','🖛','🖜','🖝','🖞','🖟',
|
||||
'🖠','🖡','🖢','🖣','🖤','🖥','🖦','🖧','🖨','🖩',
|
||||
'🖪','🖫','🖬','🖭','🖮','🖯','🖰','🖱','🖲','🖳',
|
||||
'🖴','🖵','🖶','🖷','🖸','🖹','🖺','🖻','🖼','🖽',
|
||||
'🖾','🖿','🗀','🗁','🗂','🗃','🗄','🗅','🗆','🗇',
|
||||
'🗈','🗉','🗊','🗋','🗌','🗍','🗎','🗏','🗐','🗑','🗒',
|
||||
'🗓','🗔','🗕','🗖','🗗','🗘','🗙','🗚','🗛','🗜',
|
||||
'🗝','🗞','🗟','🗠','🗡','🗢','🗣','🗤','🗥','🗦',
|
||||
'🗧','🗨','🗩','🗪','🗫','🗬','🗭','🗮','🗯','🗰',
|
||||
'🗱','🗲','🗳','🗴','🗵','🗶','🗷','🗸','🗹','🗺',
|
||||
'🗻','🗼','🗽','🗾','🗿','😀'];
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import {chars} from './chars.js'
|
||||
let imp = import('./char.js')
|
||||
/* eslint-disable no-unused-vars */
|
||||
import {chars} from './chars.js';
|
||||
let imp = import('./char.js');
|
||||
let mod;
|
||||
|
||||
let counters = [];
|
||||
@ -8,7 +9,7 @@ imp.then(wasm => {
|
||||
addCounter();
|
||||
let b = document.getElementById('add-counter');
|
||||
if (!b) throw new Error('Unable to find #add-counter');
|
||||
b.addEventListener('click', ev => addCounter())
|
||||
b.addEventListener('click', ev => addCounter());
|
||||
});
|
||||
|
||||
function addCounter() {
|
||||
@ -21,7 +22,7 @@ function update() {
|
||||
let container = document.getElementById('container');
|
||||
if (!container) throw new Error('Unable to find #container in dom');
|
||||
while (container.hasChildNodes()) {
|
||||
if (container.lastChild.id == "add-counter") break;
|
||||
if (container.lastChild.id == 'add-counter') break;
|
||||
container.removeChild(container.lastChild);
|
||||
}
|
||||
for (var i = 0; i < counters.length; i++) {
|
||||
@ -29,7 +30,7 @@ function update() {
|
||||
container.appendChild(newCounter(counter.key(), counter.count(), ev => {
|
||||
counter.increment();
|
||||
update();
|
||||
}))
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
entry: "./index.js",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "dist"),
|
||||
filename: "index.js",
|
||||
},
|
||||
mode: "development"
|
||||
entry: './index.js',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'index.js',
|
||||
},
|
||||
mode: 'development'
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
// For more comments about what's going on here, check out the `hello_world`
|
||||
// example
|
||||
const rust = import("./closures");
|
||||
const rust = import('./closures');
|
||||
rust.then(m => m.run());
|
||||
|
@ -1,10 +1,10 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
entry: "./index.js",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "dist"),
|
||||
filename: "index.js",
|
||||
},
|
||||
mode: "development"
|
||||
entry: './index.js',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'index.js',
|
||||
},
|
||||
mode: 'development'
|
||||
};
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
const mod = import('./comments');
|
||||
let wasm;
|
||||
mod.then(m => {
|
||||
@ -48,7 +49,7 @@ function storeComments() {
|
||||
name: c.name(),
|
||||
comment: c.comment(),
|
||||
count: c.count,
|
||||
}
|
||||
};
|
||||
});
|
||||
localStorage.setItem('comments', JSON.stringify(json));
|
||||
}
|
||||
@ -118,10 +119,10 @@ function renderComment(comment) {
|
||||
bottom.appendChild(title);
|
||||
let text = document.createElement('span');
|
||||
text.setAttribute('class', 'comment-text');
|
||||
text.appendChild(document.createTextNode(comment.comment()))
|
||||
text.appendChild(document.createTextNode(comment.comment()));
|
||||
bottom.appendChild(text);
|
||||
div.appendChild(top);
|
||||
div.appendChild(bottom)
|
||||
div.appendChild(bottom);
|
||||
return div;
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
entry: "./index.js",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "dist"),
|
||||
filename: "index.js",
|
||||
},
|
||||
mode: "development",
|
||||
devtool: 'source-map',
|
||||
entry: './index.js',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'index.js',
|
||||
},
|
||||
mode: 'development',
|
||||
devtool: 'source-map',
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
// For more comments about what's going on here, check out the `hello_world`
|
||||
// example
|
||||
const rust = import("./console_log");
|
||||
const rust = import('./console_log');
|
||||
|
||||
rust.then(m => m.run());
|
||||
|
@ -1,10 +1,10 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
entry: "./index.js",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "dist"),
|
||||
filename: "index.js",
|
||||
},
|
||||
mode: "development"
|
||||
entry: './index.js',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'index.js',
|
||||
},
|
||||
mode: 'development'
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
// For more comments about what's going on here, check out the `hello_world`
|
||||
// example
|
||||
const rust = import("./dom");
|
||||
const rust = import('./dom');
|
||||
rust.then(m => m.run());
|
||||
|
@ -1,10 +1,10 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
entry: "./index.js",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "dist"),
|
||||
filename: "index.js",
|
||||
},
|
||||
mode: "development"
|
||||
entry: './index.js',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'index.js',
|
||||
},
|
||||
mode: 'development'
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Note that a dynamic `import` statement here is required due to
|
||||
// webpack/webpack#6615, but in theory `import { greet } from './hello_world';`
|
||||
// will work here one day as well!
|
||||
const rust = import("./hello_world");
|
||||
const rust = import('./hello_world');
|
||||
|
||||
rust.then(m => m.greet("World!"));
|
||||
rust.then(m => m.greet('World!'));
|
||||
|
@ -1,10 +1,10 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
entry: "./index.js",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "dist"),
|
||||
filename: "index.js",
|
||||
},
|
||||
mode: "development"
|
||||
entry: './index.js',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'index.js',
|
||||
},
|
||||
mode: 'development'
|
||||
};
|
||||
|
@ -1,21 +1,21 @@
|
||||
export function name() {
|
||||
return 'World';
|
||||
return 'World';
|
||||
}
|
||||
|
||||
export class MyClass {
|
||||
constructor() {
|
||||
this._number = 42;
|
||||
}
|
||||
constructor() {
|
||||
this._number = 42;
|
||||
}
|
||||
|
||||
get number() {
|
||||
return this._number;
|
||||
}
|
||||
get number() {
|
||||
return this._number;
|
||||
}
|
||||
|
||||
set number(n) {
|
||||
return this._number = n;
|
||||
}
|
||||
set number(n) {
|
||||
return this._number = n;
|
||||
}
|
||||
|
||||
render() {
|
||||
return `My number is: ${this.number}`;
|
||||
}
|
||||
render() {
|
||||
return `My number is: ${this.number}`;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
// For more comments about what's going on here, check out the `hello_world`
|
||||
// example
|
||||
const rust = import("./import_js");
|
||||
const rust = import('./import_js');
|
||||
|
||||
rust.then(m => m.run());
|
||||
|
@ -1,10 +1,10 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
entry: "./index.js",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "dist"),
|
||||
filename: "index.js",
|
||||
},
|
||||
mode: "development"
|
||||
entry: './index.js',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'index.js',
|
||||
},
|
||||
mode: 'development'
|
||||
};
|
||||
|
@ -1,10 +1,10 @@
|
||||
// For more comments about what's going on here, check out the `hello_world`
|
||||
// example
|
||||
const rust = import("./math");
|
||||
const rust = import('./math');
|
||||
|
||||
rust.then(m => {
|
||||
m.run();
|
||||
console.log('and in JS the answers look like:');
|
||||
console.log(`Math.log2(10.0) = ${Math.log2(10.0)}`);
|
||||
console.log(`Math.sin(1.2) = ${Math.sin(1.2)}`);
|
||||
m.run();
|
||||
console.log('and in JS the answers look like:');
|
||||
console.log(`Math.log2(10.0) = ${Math.log2(10.0)}`);
|
||||
console.log(`Math.sin(1.2) = ${Math.sin(1.2)}`);
|
||||
});
|
||||
|
@ -1,10 +1,10 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
entry: "./index.js",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "dist"),
|
||||
filename: "index.js",
|
||||
},
|
||||
mode: "development"
|
||||
entry: './index.js',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'index.js',
|
||||
},
|
||||
mode: 'development'
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
// For more comments about what's going on here, check out the `hello_world`
|
||||
// example
|
||||
const rust = import("./performance");
|
||||
const rust = import('./performance');
|
||||
rust.then(m => m.run());
|
||||
|
@ -1,10 +1,10 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
entry: "./index.js",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "dist"),
|
||||
filename: "index.js",
|
||||
},
|
||||
mode: "development"
|
||||
entry: './index.js',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'index.js',
|
||||
},
|
||||
mode: 'development'
|
||||
};
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
[View this example online](https://webassembly.studio/?f=t61j18noqz)
|
||||
|
||||
This directory is an smattering of examples using the `#[wasm_bindgen]` macro.
|
||||
This directory is a smattering of examples using the `#[wasm_bindgen]` macro.
|
||||
Here we see passing strings back and for, exporting classes from Rust to JS,
|
||||
importing classes from JS to Rust, etc.
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { Foo, Bar, concat } from "./smorgasboard";
|
||||
import { Foo, Bar, concat } from './smorgasboard';
|
||||
|
||||
function assertEq(a, b) {
|
||||
if (a !== b)
|
||||
throw new Error(`${a} != ${b}`);
|
||||
console.log(`found ${a} === ${b}`);
|
||||
if (a !== b)
|
||||
throw new Error(`${a} != ${b}`);
|
||||
console.log(`found ${a} === ${b}`);
|
||||
}
|
||||
|
||||
assertEq(concat('a', 'b'), 'ab');
|
||||
@ -18,7 +18,7 @@ foo.free();
|
||||
|
||||
// Pass objects to one another
|
||||
let foo1 = new Foo();
|
||||
let bar = Bar.from_str("22", { opaque: 'object' });
|
||||
let bar = Bar.from_str('22', { opaque: 'object' });
|
||||
foo1.add_other(bar);
|
||||
|
||||
// We also don't have to `free` the `bar` variable as this function is
|
||||
@ -29,4 +29,4 @@ foo1.consume_other(bar);
|
||||
assertEq(foo1.add(2), 22 + 34 + 2);
|
||||
foo1.free();
|
||||
|
||||
alert('all passed!')
|
||||
alert('all passed!');
|
||||
|
@ -1,14 +1,14 @@
|
||||
export function bar_on_reset(s, token) {
|
||||
console.log(token);
|
||||
console.log(`this instance of bar was reset to ${s}`);
|
||||
console.log(token);
|
||||
console.log(`this instance of bar was reset to ${s}`);
|
||||
}
|
||||
|
||||
export class Awesome {
|
||||
constructor() {
|
||||
this.internal = 32;
|
||||
}
|
||||
constructor() {
|
||||
this.internal = 32;
|
||||
}
|
||||
|
||||
get_internal() {
|
||||
return this.internal;
|
||||
}
|
||||
get_internal() {
|
||||
return this.internal;
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
import("./app");
|
||||
import('./app');
|
||||
|
@ -1,10 +1,10 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
entry: "./index.js",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "dist"),
|
||||
filename: "index.js",
|
||||
},
|
||||
mode: "development"
|
||||
entry: './index.js',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'index.js',
|
||||
},
|
||||
mode: 'development'
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
// For more comments about what's going on here, check out the `hello_world`
|
||||
// example
|
||||
const rust = import("./wasm_in_wasm");
|
||||
const rust = import('./wasm_in_wasm');
|
||||
rust.then(m => m.run());
|
||||
|
@ -1,10 +1,10 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
entry: "./index.js",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "dist"),
|
||||
filename: "index.js",
|
||||
},
|
||||
mode: "development"
|
||||
entry: './index.js',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'index.js',
|
||||
},
|
||||
mode: 'development'
|
||||
};
|
||||
|
@ -3,10 +3,13 @@
|
||||
"scripts": {
|
||||
"run-webpack": "webpack",
|
||||
"run-webpack-dev-server": "webpack-dev-server",
|
||||
"run-geckodriver": "geckodriver"
|
||||
"run-geckodriver": "geckodriver",
|
||||
"run-lint-examples": "eslint ./examples",
|
||||
"run-lint-generated-tests": "eslint ./target/generated-tests/*/out*js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^10.5.2",
|
||||
"babel-eslint": "^8.2.5",
|
||||
"eslint": "^5.0.1",
|
||||
"geckodriver": "^1.11.0",
|
||||
"selenium-webdriver": "^4.0.0-alpha.1",
|
||||
@ -14,7 +17,6 @@
|
||||
"typescript": "^2.7.2",
|
||||
"webpack": "^4.15.1",
|
||||
"webpack-cli": "^3.0.8",
|
||||
"webpack-dev-server": "^3.1.4",
|
||||
"babel-eslint": "^8.2.5"
|
||||
"webpack-dev-server": "^3.1.4"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user