Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including wcjs-time-callback with all npm packages installed. Try it out:

var wcjsTimeCallback = require("wcjs-time-callback")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

wcjs-time-callback v0.1.0

Node.js module to attach callbacks to specific times in a WebChimera playback.

wcjs-time-callback

Node.js module to attach callbacks to specific times in a WebChimera playback.

This module makes smart use of the events provided by WebChimera and combine them with native javascript timeouts to trigger callbacks at very specific times.

Usage

const vlc = require('wcjs-renderer').init(canvas);

const timing = require('wcjs-time-callback').for(vlc);

timing.onTime(12500, function() {
  console.log('hello');  // will trigger at exactly 12 sec and 500 ms,
                         // every time playback reaches that time.
});

timing.onTime(14200, function() {
  console.log('hi');
}, {
  singleShot: true,   // will trigger at 14 sec and 200ms
                      // but only the first time playback reaches that time
});

License

The MIT License (MIT) - Copyright (c) 2016 Alexandre Bintz alexandre@bintz.io
See LICENSE file for full text.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free