Convert Timer interval to be milliseconds
Reported by Joe Gornick | 2009-03-12 17:27:47 UTC
Compared to every other timer in other languages, timer always accepts milliseconds and not seconds.
I say we convert the interval property to accept milliseconds.
Comments and changes to this ticket
-

John-David Dalton 2009-07-03 17:48:29 UTC
- Milestone cleared.
-

Kit Goncharov 2009-07-04 23:23:16 UTC
That, or change the constructor to accept an options hash instead of just two arguments:
new Fuse.Timer({ callback: function(){ //... }, timeout: 5000, //`timeout` seems more concise than `interval`... unit: 'millisecond' });The disadvantage to this is that it creates more overhead, and also requires a lot more abstraction in the actual
Timerclass (and then there's the additional issue of which units to support). Another alternative might be amultipleoption (so, for seconds, settimeoutto 5 andmultipleto 1000), but that also seems slightly redundant and unnecessary.I think using seconds for the timeout unit seems more intuitive, but, if it's inconsistent with other languages, then it's probably a good idea to switch it to milliseconds after all. Just playing around with various ideas... :)
-

John-David Dalton 2009-07-05 09:14:11 UTC
Something else to think about is
// ActionScript 3 Timer Class var myIndetifier:Timer = new Timer(delay, repeat-count); myIdentifier.addEventListener(TimerEvent.TIMER, timerListener); function timerListener (e:TimerEvent):void{ //commands } myIdentifier.start();Maybe later with an object event system something like this may be doable.
Also they use the worddelay, others usecountDown, and others still usetime intervals -

John-David Dalton 2009-07-05 09:20:38 UTC
I dig the
multipleoption adds very little to overhead and allows for some customizations like:// boom Prototype compat.Fuse.Timer.defaultOptions.multiple = 1000;also currently we use
defaultOptionsinFuse.Ajax.Base.defaultOptionswould justoptionsseem fitting sense it is on the constructor ? (Fuse.Ajax.Base.optionsorFuse.Timer.options -

John-David Dalton 2009-07-05 09:22:28 UTC
- Assigned user changed from Joe Gornick to Kit Goncharov
-

Kit Goncharov 2009-07-08 12:33:23 UTC
- Tag cleared.
Sorry, I accidentally deleted my fork of Fuse on GitHub. I'll refork it and re-push the patch again... :(
What do you think about extending the timer capabilities to exception handling? So the
optionshash will look something like this:new Fuse.Timer({ onTimeout: function(){ ... }, onException: function(exception){ ... }, timeout: 15, multiple: 1000 }); -

John-David Dalton 2009-07-08 12:40:22 UTC
Careful with that delete :D
I dig the exception handling, its should be a new ticket item though.
-

Kit Goncharov 2009-07-08 13:11:43 UTC
The commit URL containing the Timer updates is:
https://github.com/kitsg/fusejs/commit/4d5c3634b69420dfad3f51271820...
In that commit, I accidentally left an erroneous entry in
timer_test.js, so this commit fixes that:https://github.com/kitsg/fusejs/commit/00be5a50c8c0d2ac267a07d038a0...
-

Kit Goncharov 2009-07-08 13:11:57 UTC
- Tag set to patched
-

-

John-David Dalton 2009-07-09 13:55:17 UTC
Ok I have been milling over these changes.
I would think that because of it being a timer that some arguments should not be optional
andFuse.Timer(callback, interval, options);optionscan hold themultiplierandonExceptionproperties -

John-David Dalton 2009-07-10 12:52:54 UTC
- State changed from open to resolved
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
JavaScript frameworks share similar features and functionality such as DOM manipulation, event registration, and CSS selector engines. FuseJS attempts to incorporate the strengths of these frameworks into one stable, efficient, and optimized core JavaScript framework.