To start using clockWise.js :
① Download the file here :
↓ clockWise.js version 2.0 (42Kb)
② Place it in your project's directory
③ Link it inside the <head> section of your concerned HTML document(s) like this (assuming you located the file in a directory called "scripts") :
    <script type="text/javascript" src="scripts/clockwise.js"></script>
This will make the clockWise object and all of its methods accessible and ready to use in your project.
Syntax : Timeout and Interval objects
→ Just add clockWise. before your setTimeout(), clearTimeout(), setInterval() or clearInterval() calls to use their enhanced versions.
        
        var T = clockWise.setTimeout(some_function, 1000);
        
        var T = clockWise.setTimeout(
                            function() {
        
                            } , 1000
                            );
    
    → The native functions are still available. But objects returned by them won't accept any "advanced" manipulation, as well as no object returned by a clockWise method
    will accept a "classical" one. For example :
        var classic_T = setTimeout(some_function, 1000);
        var enhanced_T = clockWise.setTimeout(some_function, 1000);
        
        clearTimeout(classic_T); 
        clockWise.clearTimeout(classic_T); 
        clearTimeout(enhanced_T); 
        clockWise.clearTimeout(enhanced_T); 
        
    
    → The extended methods are part of the clockWise object too and must be called in a similar way as seen above. They can't be applied to "classic" objects.
        var classic_T = setTimeout(some_function, 1000);
        var enhanced_T = clockWise.setTimeout(some_function, 1000);
        
        clockWise.pauseTimeout(classic_T); 
        clockWise.pauseTimeout(enhanced_T); 
        pauseTimeout(classic_T); 
        
    
    → Just like window.setTimeout() is the same as setTimeout(),
    window.clockWise.setTimeout() and clockWise.window.setTimeout() are accepted syntax.
    This also applies to Interval- and Sequence-related methods.
Timeout object reference →
Interval object reference →
Syntax : Sequence objects
    → Dealing with a Sequence object requires three steps.
    
    First, the object must be initialized.
    
        var S = clockWise.setSequence();
    
    Then, events can be set at desired points of a timeline. This is how a more or less complex sequence is built.
    
        S.at(500);
        S.do(a_first_function);
        S.after(1000);
        S.do(a_second_function);
    
    Once the sequence is ready, it can be controlled.
    
        S.play();
    
    In this example, calling the object's play() method will trigger a_first_function() after a 500 milliseconds delay,
    then a_second_function() after 1000 more milliseconds.
    
    → Methods can be chained, meaning the previous example can be rewritten as follows :
    
        var S = clockWise.setSequence().at(500).do(a_first_function).after(1000).do(a_second_function).play();
    
    Or maybe in a more convenient style, in logical blocks :
    
        var S = clockWise.setSequence();
        S.at(500).do(a_first_function);
        S.after(1000).do(a_second_function);
        
        S.play();
    
Sequence object reference →