[ADDED] [V0.7] Timer in coolite?

  1. #1

    [ADDED] [V0.7] Timer in coolite?

    Hi
    Does it by any chance exist a timer im the coolite package. Say if I want to execute a function every 2 minutes or so?

    Best regards
    Mikael Jürke
  2. #2

    RE: [ADDED] [V0.7] Timer in coolite?

    Hi Mikael,

    Great suggestion!*


    There is currently no <ext:Timer> control, although I think it should be fairly easy to build. I'll see what we can do over the next couple days.*


    Geoffrey McGill
    Founder
  3. #3

    RE: [ADDED] [V0.7] Timer in coolite?

    Hi
    That would be great! thank you very much!

    /Mikael
  4. #4

    RE: [ADDED] [V0.7] Timer in coolite?

    After doing some research on the ExtJS site, I found the suggestion to use Ext.util.TaskRunner to create a timer. *Looking at the API, it appears to take two lines of JavaScript.

    var delay = new Ext.util.TaskRunner(1000);
    delay.start();

    This should create a 1 second delay.


    To apply this code in Coolite, I tried insert this code using the ScriptManager. *


    this.ScriptManager.AddScript("var delay = new Ext.util.TaskRunner(1000);");
    this.ScriptManager.AddScript("delay.start();");

    Unforunately when I do this *I receive a JavaScript error in FireBug that says 'task is undefined'. And the error occurs on this line... task.taskStartTime = new Date().getTime(); in coolite.axd.


    Question is, are their ExtJS Framework files not included in Coolite, or did I attempt to implement this incorrectly?


    -mc
  5. #5

    RE: [ADDED] [V0.7] Timer in coolite?



    Hi mc,

    We will be implementing a <Tasks> feature into <ext:ScriptManager> that will allow for the addition of one-to-many <ext:Task> definitions. This feature will be available with the v0.7 release. The <ext:Task> will also include the ability to make server-side calls via an AjaxEvent.

    To get your code sample working you need to pass in a task configuration into the .start() function.

    The following example demonstrates a complete sample.

    Example

    <ext:ScriptManager ID="ScriptManager1" runat="server">
        <Listeners>
            <DocumentReady Handler="var task = new Ext.util.TaskRunner();
                task.start({
                    run: function(){
                        // do something here
                        console.log(new Date());
                    },
                    interval: 1000 //1 second
                });" 
                />
        </Listeners>
    </ext:ScriptManager>
    Hope this helps.
    Geoffrey McGill
    Founder
  6. #6

    RE: [ADDED] [V0.7] Timer in coolite?

    *That's excellent news... thanks for the the help and quick response.
  7. #7

    RE: [ADDED] [V0.7] Timer in coolite?

    We have added the <ext:TaskManager> to the v0.7 release.

    A sample demonstrating the <ext:TaskManager> is available in the SVN Examples Explorer, see Miscellaneous/TaskManager/Overview/

    With the TaskManager, you can add "Tasks" which include many options for timed events (Listeners and AjaxEvents), starting and stopping.

    Example

    <script runat="server">
        protected void Task2_Interval(object sender, AjaxEventArgs e)
        {
            // Runs every 5 seconds.
            this.Label1.Text = DateTime.Now.ToString("HH:mm:ss");
        }
    </script> 
        
    <ext:TaskManager ID="TaskManager2" runat="server">
        <Tasks>
            <ext:Task TaskID="Task1" Interval="1000">
                <Listener Handler="console.log(new Date());" />
            </ext:Task>
            <ext:Task TaskID="Task2" Interval="5000">
                <AjaxEvent OnEvent="Task2_Interval" />
            </ext:Task>
        </Tasks>
    </ext:TaskManager>
    Hope this helps.

    Geoffrey McGill
    Founder
  8. #8

    RE: [ADDED] [V0.7] Timer in coolite?

    Oh cool! looks great!

    /Mikael
  9. #9

    RE: [ADDED] [V0.7] Timer in coolite?

    I forgot to post that there is now an example in the explorer which demonstratest the use of the <ext:TaskManager>, see*https://examples1.ext.net/#/Miscella...ager/Overview/

    Hope this helps.


    Geoffrey McGill
    Founder
  10. #10

    RE: [ADDED] [V0.7] Timer in coolite?

    Geoffrey,

    I didn't know if this was on your list of things to do, but you are also missing an example for the <ext:ProgressBar> control.

    Thanks,
    MindCore

Similar Threads

  1. Replies: 12
    Last Post: Jun 04, 2012, 11:18 AM
  2. How to work with Timer in EXT.NET
    By archana in forum 1.x Help
    Replies: 1
    Last Post: Oct 24, 2011, 8:29 PM
  3. [1.0] Using function delay as timer
    By nextSTEP in forum 1.x Help
    Replies: 2
    Last Post: Apr 22, 2011, 9:05 PM
  4. [CLOSED] Timer in gridpanel
    By majestic in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 21, 2009, 7:29 AM
  5. [CLOSED] timer
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 12, 2009, 7:56 AM

Posting Permissions