mpv-promise

0.1.0 • Public • Published

mpv-promise

Promise polyfill for mpv JavaScript runtime.

Install

npm i mpv-promise

Usage with TypeScript

Example tsconfig.json:

{
  "compilerOptions": {
    "lib": ["ES5", "ES2015.Promise"],
    "target": "ES5",
    "module": "ESNext",
    "moduleResolution": "node"
  }
}
import "mpv-promise";

async function sleep(t: number) {
  return new Promise((resolve) => {
    setTimeout(resolve, Math.abs(t) || 0);
  });
}

async function main() {
  while (true) {
    await sleep(1000);
    mp.osd_message(mp.get_time());
    await sleep(500);
    mp.osd_message(mp.get_time());
  }
}

main();

Package Sidebar

Install

npm i mpv-promise

Weekly Downloads

3

Version

0.1.0

License

MIT

Unpacked Size

13.4 kB

Total Files

4

Last publish

Collaborators

  • kagami