Code Monkey home page Code Monkey logo

hacktimer's People

Contributors

ctubio avatar iamdriz avatar stjernstrom avatar turuslan avatar wibimaster 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  avatar

hacktimer's Issues

How does this code work?

Hello,

many thanks for this hack. But I would like to know how it actually works?
How does the webworker keep javascript timers going?

thank you for any help

If the worker is not set in global scope, it gets GC'd

Although this is a browser bug, many in-use versions of Chrome and possibly also Firefox and other browsers can GC web workers that don't have a reference in the window global scope.
This causes a lot of weird issues like everything appears to work - then suddenly no more messages from the web worker arrive.

Help implement HackTimer using SharedWorker

When you open more tabs (Like 10 .. 20 or more), with each tab opening a new worker to implement HackTimer, there is an impact on system performance.

Is it possible to utilize SharedWorker to implement HackTimer?

We hope this will help achieve the same functionality across all the tabs using a single shared worker.
If possible can you please suggest the changes required?

Can you share your thoughts?

publish on bower

much like having this on npm, having this on bower would be great. along with this, having a tag would be awesome, since bower works on tags.

Google Chrome

Unfortunately, it looks like Google may have patched around this wonderful webworker hack. (This hack fails in Google Chrome 54.0.2840.71). Our team is investigating but we thought we'd submit an issue here too. If we discover the solution we'll be more than happy to contribute to this work.

TypeError: f[e.data] is undefined on Firefox

When I'm using Firefox, there is a
TypeError: f[e.data] is undefined HackTimer.min.js:1:538
on the console.
But the functions is still working fine, do you know what it means?
Thanks!

Publish to bower

'bower install hacktimer' results in a 'package hacktimer not found'

How to use it?

Hi, how to use it, can you give me an example? How can I currently replace my setInterval with libraries setInterval in reactjs?

Error On Remove Element

Error In Console:

Uncaught TypeError: Cannot read property 'innerHTML' of null
    at unMinified.js:69
    at Worker.worker.onmessage (HackTimer.js:134)

Line 68 & 69 of unMinified.js:

window.backspaceClock[index] = setInterval(function(){
str = document.getElementById(x[0].id).innerHTML;

The unMinified.js file is from my library .

Explanation:

I am using this library as my library relies heavily on timing. I have even mentioned your library in the Getting Started section.

Why is this happening when I do this: document.getElementById("intro").parentNode.removeChild(document.getElementById("intro"));?

I have stopped the animation which stops all the loops, you can check out the unMinified.js file to see exactly what happens.

Shouldn't this library stop whatever is happening when whatever element is removed?

Thanks for such a great library!

Can i use it now

Hot to use it.my project includes like:

<script src="bower_components/someLib/HackTimer.min.js"></script> <script src="bower_components/someLib/HackTimer.silent.min.js"></script> <script src="bower_components/someLib/HackTimerWorker.min.js"></script>

not available (my english so bed)

Race condition that lead to bad fakeId generation

Hi, I'm developing an HTML5 game (port of an old game, see http://ydkjs.eu or https://github.com/Mwyann/ydkjs) and i'm using this library to prevent the game from pausing when the tab loses focus. But I'm using a lot of timeouts and frequently the getFakeId would give the same ID to a couple of timeouts, leading to bugs obviously (callbacks not called properly).

For now I got around the problem by generating random fakeIds, that's maybe not very clean and maybe there's a 0.00001% chance of collision but that's enough for me :)

        function getFakeId () {
            var newId;
            do {
                newId = Math.floor(Math.random()*maxFakeId);
            } while (fakeIdToCallback.hasOwnProperty (newId));
            return newId;
        }

If there's a better solution, I'd be glad to know it.

excessive memory leaking

over time, if used for a really long time (8-36 hours) this causes a webpage to become incredibly slow. tested with and without on a project and the speed does not drop if hacktimer is not included.

Publish to npm

It would be nice if this source was made available via npm.

doesn't work perfectly under Safari

Under Safari, I see a situation where my 10hz interval timer is called ok while there is other activity in the page that creates other events of various kinds, however when there is a pause in the other events, all interval timers cease being called for 10 seconds or longer.
Then they resume, as though everything was just suspended.

Unfortunately I have not tried to make a tiny example of this happening :(

Fix IE10

Please add the following code before try/catch block which creates new Blob. In IE10 there is a problem when creating Blob (security error)

if(!/MSIE 10/i.test(navigator.userAgent)) {
try {
var blob = new Blob (["
var fakeIdToId = {};\
...

} catch (error) {
/* Blob is not supported, use external script instead */
}
}

Causes deferred long-running timer task(s) error.

When using HackTimer.js, In my browser's console a warning is logged :
Deferred long-running timer task(s) to improve scrolling smoothness. See crbug.com/574343.

And The whole website lags.

Any fix for this?

Using latest File.

minified version in IE9 fix

(function(s) {
var w, f = {},
o = window,
l = console,
m = Math,
z = 'postMessage',
p = 0,
r = 'hasOwnProperty',
y = [].slice,
x = 'fail',
v = Worker;

v = Worker; <----
Worker is undefined, script crashes before hitting this check:

if (typeof(v) !== 'undefined') {

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.