Git Product home page Git Product logo

bunchie's People

Contributors

ralusek avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

bunchie's Issues

"Maximum call stack size exceeded" when bunchie works too well

If bunching accumulates more than certain number of calls (eg. 65535 on Chrome) you get a Maximum call stack size exceeded (https://stackoverflow.com/questions/22747068/is-there-a-max-number-of-arguments-javascript-functions-can-accept). I worked around this by setting maxCount to 65535 (majority of our users are on Chrome).

I'm wondering if it could be a good idea to have this cap builtin for bunchie perhaps using code like below:

function testArgumentsLength() {}
function maxStackSize() {
  var argumentsLength = 0;
  try {
    for (var i = 1; i < 32; i++) {
      argumentsLength = (argumentsLength << 1) + 1;
      testArgumentsLength.apply(null, new Array(argumentsLength));
    }
  } catch (e) {
    return argumentsLength >> 1;
  }
}

Support exception handling

At the moment errors it's not possible to pass the errors up the chain, resulting in Uncaught (in promise) Error.

Handle debounce once within a single event loop

At the moment if bunchied function is called many times from a single event loop bunchie still recreates setTimeout handler. In our project this this causes a significant performance penalty. Instead bunchie could only handle debounce once per event loop, ie:

  // Handle debounce.
  if (!activeHandleDebounce) {
    activeHandleDebounce = setTimeout(function () {
      ...
      activeTimeout = setTimeout(function () {
        return handle.apply(undefined, args);
      }, deadline);
      activeHandleDebounce = undefined;
    }, 0);
  }

I can submit pull request for this.

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.