Skip to content

Instantly share code, notes, and snippets.

View men232's full-sized avatar
🎯
Focusing

Andrew L. men232

🎯
Focusing
  • Ukraine
View GitHub Profile
@men232
men232 / index.html
Last active May 14, 2024 18:36
Capture webcam (fullscreen)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="reset.css">
<title>How to record a video with JavaScript</title>
</head>
<body>
<video autoplay muted playsinline id="videoLive"></video>
@men232
men232 / appinject.mjs
Last active January 16, 2024 19:09
NodeJs provide-inject (vue style)
import { AsyncLocalStorage } from 'node:async_hooks';
const ALS = new AsyncLocalStorage();
/**
* Execute provided function in async context.
* @param {function} fn
*/
export function withAppInject(fn) {
return ALS.run(new Map(), fn);