Requires

Provides

Contains Function Prototypes like create, bind, pass, and delay.

License:
MIT-style license.
  1. 18
  2. 19
  3. 20
  4. 21
  5. 22
  6. 23
  7. 24
  8. 25
  9. 26
  10. 27
  11. 28
  12. 29
  13. 30
  14. 31
  15. 32
  16. 33
  17. 34
  18. 35
  19. 36
  20. 37
  21. 38
  22. 39
  23. 40
  24. 41
  25. 42
  26. 43
  27. 44
  28. 45
  29. 46
  30. 47
  31. 48
  32. 49
  33. 50
  34. 51
  35. 52
  36. 53
  37. 54
  38. 55
  39. 56
  40. 57
  41. 58
  42. 59
  43. 60
  44. 61
  45. 62
  46. 63
  47. 64
  48. 65
  49. 66
  50. 67
  51. 68
Function.extend({ attempt: function(){ for (var i = 0, l = arguments.length; i < l; i++){ try { return arguments[i](); } catch (e){} } return null; } }); Function.implement({ attempt: function(args, bind){ try { return this.apply(bind, Array.from(args)); } catch (e){} return null; }, bind: function(bind){ var self = this, args = (arguments.length > 1) ? Array.slice(arguments, 1) : null; return function(){ if (!args && !arguments.length) return self.call(bind); if (args && arguments.length) return self.apply(bind, args.concat(Array.from(arguments))); return self.apply(bind, args || arguments); }; }, pass: function(args, bind){ var self = this; if (args != null) args = Array.from(args); return function(){ return self.apply(bind, args || arguments); }; }, delay: function(delay, bind, args){ return setTimeout(this.pass((args == null ? [] : args), bind), delay); }, periodical: function(periodical, bind, args){ return setInterval(this.pass((args == null ? [] : args), bind), periodical); } });

<1.2compat>

  1. 72
  2. 73
  3. 74
  4. 75
  5. 76
  6. 77
  7. 78
  8. 79
  9. 80
  10. 81
  11. 82
  12. 83
  13. 84
  14. 85
  15. 86
  16. 87
  17. 88
  18. 89
  19. 90
  20. 91
  21. 92
  22. 93
  23. 94
  24. 95
  25. 96
  26. 97
  27. 98
  28. 99
  29. 100
  30. 101
  31. 102
  32. 103
  33. 104
  34. 105
  35. 106
  36. 107
  37. 108
  38. 109
  39. 110
  40. 111
  41. 112
  42. 113
  43. 114
  44. 115
delete Function.prototype.bind; Function.implement({ create: function(options){ var self = this; options = options || {}; return function(event){ var args = options.arguments; args = (args != null) ? Array.from(args) : Array.slice(arguments, (options.event) ? 1 : 0); if (options.event) args = [event || window.event].extend(args); var returns = function(){ return self.apply(options.bind || null, args); }; if (options.delay) return setTimeout(returns, options.delay); if (options.periodical) return setInterval(returns, options.periodical); if (options.attempt) return Function.attempt(returns); return returns(); }; }, bind: function(bind, args){ var self = this; if (args != null) args = Array.from(args); return function(){ return self.apply(bind, args || arguments); }; }, bindWithEvent: function(bind, args){ var self = this; if (args != null) args = Array.from(args); return function(event){ return self.apply(bind, (args == null) ? arguments : [event].concat(args)); }; }, run: function(args, bind){ return this.apply(bind, Array.from(args)); } }); var $try = Function.attempt;

</1.2compat>