Some of the features mentioned in this document only work on the beta or Dev channel. To change your channel:
- chrome://help in a browser window
- Click Detailed Build Information
- Change Channel
- Select Beta (Or Dev, if you're feeling adventurous)
| function MyResponsiveComponent() { | |
| const width = useWindowWidth(); // Our custom Hook | |
| return ( | |
| <p>Window width is {width}</p> | |
| ); | |
| } |
Download and Install Emscripten
/home/usergit clone https://github.com/emscripten-core/emsdk.gitcd emsdkgit checkout main./emsdk install latest./emsdk activate latestsource ./emsdk_env.sh| { | |
| "name": "tf-js", | |
| "version": "1.0.0", | |
| "main": "script.js", | |
| "license": "MIT", | |
| "dependencies": { | |
| "@tensorflow-models/mobilenet": "^0.2.2", | |
| "@tensorflow/tfjs": "^0.12.3", | |
| "@tensorflow/tfjs-node": "^0.1.9", | |
| "jpeg-js": "^0.3.4" |
| .PHONY: install uninstall test set-default | |
| test: | |
| sudo apt install plymouth-x11 | |
| sudo plymouthd ; sudo plymouth --show-splash ; for ((I=0; I<10; I++)); do sleep 1 ; sudo plymouth --update=test$I ; done ; sudo plymouth --quit | |
| uninstall: | |
| rm -rv /usr/share/plymouth/themes/first || true | |
| install: uninstall |
| /** | |
| Main thread (e.g. index.js) | |
| **/ | |
| const audioCtx = new AudioContext() | |
| // Loads module script via AudioWorklet. | |
| audioCtx.audioWorklet.addModule('reverb-processor.js') | |
| .then(() => getLiveAudio(audioCtx)) | |
| .then((liveIn) => { | |
| // After the resolution of module loading, an AudioWorkletNode can be constructed. |
| MIT License | |
| Copyright (c) 2018 Noel Bundick | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is | |
| furnished to do so, subject to the following conditions: |
| /** @license | |
| * Copyright 2016 - 2017 Google LLC. All Rights Reserved. | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); you may not | |
| * use this file except in compliance with the License. You may obtain a copy | |
| * of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
| #!/usr/bin/env node | |
| if (process.env.NODE_ENV === 'production') { | |
| throw new Error("Do not use nodemon in production, run bin/www.js directly instead"); | |
| } | |
| const nodemon = require('nodemon'); | |
| const ngrok = require('ngrok'); | |
| // We start an ngrok tunnel to ensure it stays the same for the entire process |
Last updated: 2021-02-21, tested with socket.io v3.1.1
This is the simplest implementation you will find for a client/server WebSockets architecture using socket.io.
To see a full explanation, read my answer on SO here: https://stackoverflow.com/a/24232050/778272.
If you're looking for examples using frameworks, check these links: