timjansen / PinkySwear.js

Promises/A+ compliant in less than 500 bytes
89 stars 12 forks source link

Support for deferring using setImmediate #5

Closed fatso83 closed 10 years ago

fatso83 commented 10 years ago

Added support for running using setImmediate - if available. Some browser support + efficient shims.

Increased the execution speed of the tests for my promises-based framework by 70x (274ms -> 4ms).

Shims and more info at http://jphpsf.github.io/setImmediate-shim-demo

A future addition might be to include support for MutationObserver, which is now available in all browsers.

timjansen commented 10 years ago

Thank you for your patch, but I'm afraid I need to modify this a bit to work in Firefox and other JS engines that do not provide setImmediate. This check should work:

if (typeof setImmediate != 'undefined')

Thanks, Tim

On Fri, May 9, 2014 at 2:52 PM, Carl-Erik Kopseng notifications@github.comwrote:

Added support for running using setImmediate - if available. Some browser support + efficient shims.

Increased the execution speed of the tests for my promises-based framework by 70x (274ms -> 4ms).

Shims and more info at http://jphpsf.github.io/setImmediate-shim-demo

A future addition might be to include support for MutationObserver, which

is now available in all browsers.

You can merge this Pull Request by running

git pull https://github.com/fatso83/PinkySwear.js master

Or view, comment on, or merge it at:

https://github.com/timjansen/PinkySwear.js/pull/5 Commit Summary

  • Support for running callbacks through the massively more efficient setImmediate function - if available.

File Changes

  • M pinkyswear-additional-functionality-test.jshttps://github.com/timjansen/PinkySwear.js/pull/5/files#diff-0(21)
  • M pinkyswear.jshttps://github.com/timjansen/PinkySwear.js/pull/5/files#diff-1(14)

Patch Links:

— Reply to this email directly or view it on GitHubhttps://github.com/timjansen/PinkySwear.js/pull/5 .

fatso83 commented 10 years ago

:+1: Sorry for that. Was in a bit of a hurry. Thank God for gatekeepers! I will try to be a bit more vigilant in my testing next time (?)!