GithubHelp home page GithubHelp logo

cobookman / html5.micio Goto Github PK

View Code? Open in Web Editor NEW
191.0 191.0 7.0 8.28 MB

WORK IN PROGRESS: HTML5 powered Hardware Communication Bus using a microphone and headphone port.

CSS 6.58% JavaScript 93.42%

html5.micio's People

Contributors

cobookman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

html5.micio's Issues

Swap setInterval for requestAnimationFrame

Hi,

setInterval is usually pretty poor for timing things.

You should get better performance by using requestAnimationFrame(). This will run at a maximum of 60fps, depending on how "busy" the rest of the system is. The latter qualification is also true of setInterval of course since javascript is single threaded.

In general you would do something like this:

function requestInterval(fn, ms) {
  var handle = {value: null};
  var timeStart = new Date().getTime();
  var rafFn = function() {
    var timeNow = new Date().getTime();
    if ( timeNow >= timeStart + ms ) {
      fn();
      timeStart = timeNow; // or maybe timeStart += ms?
    }
    handle.value = requestAnimationFrame(rafFn);
  };
  handle.value = requestAnimationFrame(rafFn);
  return handle;
}

// use it:
var handle = requestInterval(function() {console.log(Date.now());}, 1000);

// cancel it:
cancelAnimationFrame(handle.value);

I haven't tested that code, and I also assume that requestAnimationFrame is unprefixed. There are decent shims out there you could look at to, such as:

https://gist.github.com/joelambert/1002116

Opensource

Can you write out your milestones for completing this? I'd like to contribute. If you lay out what steps you want to complete, I can start contributing appropriately.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.