Is it posible to scheduler on js function?

is it posible to scheduler on js function ??

Hi @nikita_sharma,

Hmm :thinking:,
Yes, it is possible. but check it scenario.

You can add a function to schedule the event using the setInterval() or setTimeout() functions.
For example, to schedule a function call to occur every 5 seconds, you can use the following code:

frappe.ui.form.on('DocType', {
    refresh: function(frm) {
        setTimeout(function() {
            my_function();
        }, 5000);
    }
});

function my_function() {
    // Perform some action here
}

In this example, the setTimeout() function is used to schedule a call to the my_function() function after a 5-second delay. This code should be added to the refresh event handler for the DocType. The refresh event handler is called whenever the form is refreshed or reloaded.

Note that you can also use the setInterval() function to schedule a function call to occur at regular intervals. For example, to call my_function() every 5 seconds, you can use the following code:

frappe.ui.form.on('DocType', {
    refresh: function(frm) {
        setInterval(function() {
            my_function();
        }, 5000);
    }
});

function my_function() {
    // Perform some action here
}

In this example, the setInterval() function is used to schedule a call to the my_function() function every 5 seconds. This code should also be added to the refresh event handler for the DocType.

I hope this helps!
Thank You!

i knew it, but it is depands on a doctype actually i want to run a js function every one minute not only on doctype…