Skip to content

Commit

Permalink
ComChannelEndpoint has been extracted from WorkerTask
Browse files Browse the repository at this point in the history
- Worker, MessageChannel or DedicatedWorkerGlobalScope can be channel endpoints
  • Loading branch information
kaisalmen committed Oct 1, 2024
1 parent c937874 commit 54b473e
Show file tree
Hide file tree
Showing 56 changed files with 5,780 additions and 2,108 deletions.
9 changes: 6 additions & 3 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ module.exports = {
],
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module'
sourceType: 'module',
project: ['./tsconfig.json']
},
plugins: [
'@typescript-eslint'
Expand Down Expand Up @@ -64,14 +65,16 @@ module.exports = {
'@typescript-eslint/no-misused-new': 'error', // no constructors for interfaces or new for classes
'@typescript-eslint/no-namespace': 'off', // disallow the use of custom TypeScript modules and namespaces
'@typescript-eslint/no-non-null-assertion': 'off', // allow ! operator
'@typescript-eslint/parameter-properties': 'error', // no property definitions in class constructors
"@typescript-eslint/parameter-properties": "error", // no property definitions in class constructors
'@typescript-eslint/no-unused-vars': ['error', { // disallow Unused Variables
'argsIgnorePattern': '^_'
}],
'@typescript-eslint/no-var-requires': 'error', // use import instead of require
'@typescript-eslint/prefer-for-of': 'error', // prefer for-of loop over arrays
'@typescript-eslint/prefer-namespace-keyword': 'error', // prefer namespace over module in TypeScript
'@typescript-eslint/triple-slash-reference': 'error', // ban /// <reference />, prefer imports
'@typescript-eslint/type-annotation-spacing': 'error' // consistent space around colon ':'
'@typescript-eslint/type-annotation-spacing': 'error', // consistent space around colon ':'
'@typescript-eslint/strict-boolean-expressions': 'error', // Disallow certain types in boolean expressions
'@typescript-eslint/no-unnecessary-condition': 'error' // Disallow conditionals where the type is always truthy or always falsy
}
}
2 changes: 1 addition & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
npm run test
- name: Build Production
run: |
npm --prefix packages/examples run build:production
npm run build:production
- name: Setup Pages
if: ${{ env.DEPLOY_GHP == 'true' }}
id: pages
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ docs
bundle
*.tsbuildinfo
*.tgz
.vscode/profile
2 changes: 1 addition & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
image: gitpod/workspace-full

ports:
- port: 8080
- port: 23001
onOpen: open-browser

tasks:
Expand Down
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"editorconfig.editorconfig",
"dbaeumer.vscode-eslint",
"davidanson.vscode-markdownlint",
"zixuanchen.vitest-explorer"
"vitest.explorer"
]
}
5 changes: 3 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
"url": "http://localhost:23001",
"webRoot": "${workspaceFolder}",
"userDataDir": "${workspaceFolder}/.vscode/profile"
}
]
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"vitest.enable": true
"vitest.disableWorkspaceWarning": true
}
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
- Better function and class names
- Added helper functions for creating an OffscreenCanvas and delegating events to the worker.
- Extracted `Payload` from `DataPayload` and created `RawPayload` for supporting plain messages.
- Added offscreen canvas related funcitonality and utilities:
- Added offscreen canvas related functionality and utilities:
- Provide framework independent worker and message payload extensions (`OffscreenWorker` and `OffscreenPayload`) (**wtd-core**)
- `MainEventProxy` allows configurable event delegation to a Worker (**wtd-core**)
- `ElementProxyReceiver` can be used to simulate a canvas in a Worker (**wtd-three-ext**)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const workerTask = new WorkerTask({

try {
// creates and connects the worker callback functions and the WorkerTask
workerTask.connectWorker();
workerTask.connect();

// execute without init and an empty message
const resultExec = await workerTask.executeWorker({
Expand Down Expand Up @@ -100,7 +100,7 @@ Whatever environment you choose to start [Vite](https://vitejs.dev/) is used to
If you run Vite locally you require a `nodejs` and `npm`. The Gitpod and local docker environment ensure all prerequisites are fulfilled.
In any environment the dev server is reachable on port 8080.
In any environment the dev server is reachable on port 23001.
## WorkerTaskDirector Execution Workflow
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ services:
dockerfile: Dockerfile
context: .
ports:
- target: 8080
published: 8080
- target: 23001
published: 23001
protocol: tcp
mode: host
volumes:
Expand Down
Loading

0 comments on commit 54b473e

Please sign in to comment.