Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
surma committed Apr 28, 2020
1 parent fbe0c17 commit f2e0d5c
Show file tree
Hide file tree
Showing 18 changed files with 190 additions and 190 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const obj = {
counter: 0,
inc() {
this.counter++;
}
},
};

Comlink.expose(obj);
Expand Down Expand Up @@ -118,7 +118,7 @@ await myProxy.someFunction(Comlink.transfer(data, [data.buffer]));
Lastly, you can use `Comlink.proxy(value)`. When using this Comlink will neither copy nor transfer the value, but instead send a proxy. Both threads now work on the same value. This is useful for callbacks, for example, as functions are neither structured cloneable nor transferable.

```js
myProxy.onready = Comlink.proxy(data => {
myProxy.onready = Comlink.proxy((data) => {
/* ... */
});
```
Expand All @@ -137,19 +137,19 @@ Each function parameter and return value is given to _all_ registered transfer h

```js
Comlink.transferHandlers.set("EVENT", {
canHandle: obj => obj instanceof Event,
serialize: ev => {
canHandle: (obj) => obj instanceof Event,
serialize: (ev) => {
return [
{
target: {
id: ev.target.id,
classList: [...ev.target.classList]
}
classList: [...ev.target.classList],
},
},
[]
[],
];
},
deserialize: obj => obj
deserialize: (obj) => obj,
});
```

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/01-simple-example/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const obj = {
counter: 0,
inc() {
this.counter++;
}
},
};

Comlink.expose(obj);
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ Comlink.transferHandlers.set("event", {
targetClassList: obj &&
obj.target &&
obj.target.classList && [...obj.target.classList],
detail: obj && obj.detail
detail: obj && obj.detail,
},
[]
[],
];
},
deserialize(obj) {
return obj;
}
},
});
2 changes: 1 addition & 1 deletion docs/examples/04-eventlistener-example/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ Comlink.expose({
ev.targetClassList
)}`
);
}
},
});
2 changes: 1 addition & 1 deletion docs/examples/05-serviceworker-example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
const { port1, port2 } = new MessageChannel();
const msg = {
comlinkInit: true,
port: port1
port: port1,
};
navigator.serviceWorker.controller.postMessage(msg, [port1]);

Expand Down
4 changes: 2 additions & 2 deletions docs/examples/05-serviceworker-example/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ const obj = {
counter: 0,
inc() {
this.counter++;
}
},
};

self.addEventListener("message", event => {
self.addEventListener("message", (event) => {
if (event.data.comlinkInit) {
Comlink.expose(obj, event.data.port);
return;
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/06-node-example/worker.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import nodeEndpoint from "../../../dist/esm/node-adapter.mjs";
const api = {
doMath() {
return 4;
}
},
};
Comlink.expose(api, nodeEndpoint(parentPort));
2 changes: 1 addition & 1 deletion docs/examples/99-nonworker-examples/iframes/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// import * as Comlink from "../../../../dist/esm/comlink.mjs";
async function main() {
const ifr = document.querySelector("iframe");
await new Promise(resolve => (ifr.onload = resolve));
await new Promise((resolve) => (ifr.onload = resolve));
const f = Comlink.wrap(Comlink.windowEndpoint(ifr.contentWindow));
alert(`1 + 3 = ${await f(1, 3)}`);
}
Expand Down
22 changes: 11 additions & 11 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@
* limitations under the License.
*/

module.exports = function(config) {
module.exports = function (config) {
const configuration = {
basePath: "",
frameworks: ["mocha", "chai", "detectBrowsers"],
files: [
{
pattern: "tests/fixtures/*",
included: false
included: false,
},
{
pattern: "dist/**/*.@(mjs|js)",
included: false
included: false,
},
{
pattern: "tests/*.test.js",
type: "module"
}
type: "module",
},
],
reporters: ["progress"],
port: 9876,
Expand All @@ -40,7 +40,7 @@ module.exports = function(config) {
enabled: true,
usePhantomJS: false,
preferHeadless: true,
postDetection: availableBrowsers => {
postDetection: (availableBrowsers) => {
if (process.env.INSIDE_DOCKER) {
return ["DockerChrome"];
} else if (process.env.CHROME_ONLY) {
Expand All @@ -51,17 +51,17 @@ module.exports = function(config) {
// I know that’s not a good reason to disable tests,
// but Safari TP is relatively unimportant.
return availableBrowsers.filter(
browser => browser !== "SafariTechPreview"
(browser) => browser !== "SafariTechPreview"
);
}
}
},
},
customLaunchers: {
DockerChrome: {
base: "ChromeHeadless",
flags: ["--no-sandbox"]
}
}
flags: ["--no-sandbox"],
},
},
};

config.set(configuration);
Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"test:types": "tsc -p ./tests/tsconfig.json",
"test:types:watch": "npm run test:types -- --watch",
"test": "npm run fmt_test && npm run build && npm run test:types && npm run test:unit",
"fmt": "prettier --write ./*.{mjs,js,ts,md,json,html} ./{src,docs,tests}/{,**/}*.{mjs,js,ts,md,json,html}",
"fmt_test": "test $(prettier -l ./*.{mjs,js,ts,md,json,html} ./{src,docs,tests}/{**/,}*.{mjs,js,ts,md,json,html} | wc -l) -eq 0",
"fmt": "prettier --write './*.{mjs,js,ts,md,json,html}' './{src,docs,tests}/{,**/}*.{mjs,js,ts,md,json,html}'",
"fmt_test": "test $(prettier -l './*.{mjs,js,ts,md,json,html}' './{src,docs,tests}/{**/,}*.{mjs,js,ts,md,json,html}' | wc -l) -eq 0",
"watchtest": "CHROME_ONLY=1 karma start --no-single-run"
},
"husky": {
Expand All @@ -32,21 +32,21 @@
"devDependencies": {
"chai": "4.2.0",
"conditional-type-checks": "1.0.5",
"husky": "3.1.0",
"karma": "4.4.1",
"husky": "^4.2.5",
"karma": "^5.0.2",
"karma-chai": "0.1.0",
"karma-chrome-launcher": "3.1.0",
"karma-detect-browsers": "2.3.3",
"karma-firefox-launcher": "1.2.0",
"karma-mocha": "1.3.0",
"karma-firefox-launcher": "^1.3.0",
"karma-mocha": "^2.0.0",
"karma-safari-launcher": "1.0.0",
"karma-safaritechpreview-launcher": "2.0.2",
"mocha": "6.2.2",
"prettier": "1.19.1",
"rimraf": "3.0.0",
"rollup": "1.27.8",
"rollup-plugin-terser": "5.1.2",
"rollup-plugin-typescript2": "0.25.3",
"mocha": "^7.1.2",
"prettier": "^2.0.5",
"rimraf": "^3.0.2",
"rollup": "^2.7.3",
"rollup-plugin-terser": "^5.3.0",
"rollup-plugin-typescript2": "^0.27.0",
"typescript": "3.8.3"
},
"dependencies": {}
Expand Down
16 changes: 8 additions & 8 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@ function config({ format, minify, input, ext = "js" }) {
name: "Comlink",
file: `${dir}/${input}${minifierSuffix}.${ext}`,
format,
sourcemap: true
sourcemap: true,
},
plugins: [
typescript({
clean: true,
typescript: require("typescript"),
tsconfigOverride: {
compilerOptions: {
sourceMap: true
sourceMap: true,
},
// Don’t ask. Without this, the typescript plugin is convinced
// to create subfolders and misplace the .d.ts files.
files: ["./src/comlink.ts", "./src/protocol.ts"]
}
files: ["./src/comlink.ts", "./src/protocol.ts"],
},
}),
minify
? terser({
sourcemap: true,
compress: true,
mangle: true
mangle: true,
})
: undefined
].filter(Boolean)
: undefined,
].filter(Boolean),
};
}

Expand All @@ -48,5 +48,5 @@ export default [
{ input: "node-adapter", format: "esm", minify: false, ext: "mjs" },
{ input: "node-adapter", format: "esm", minify: true, ext: "mjs" },
{ input: "node-adapter", format: "umd", minify: false },
{ input: "node-adapter", format: "umd", minify: true }
{ input: "node-adapter", format: "umd", minify: true },
].map(config);
Loading

0 comments on commit f2e0d5c

Please sign in to comment.