create a Task in global code

parkingsun's icon

How can I get a js object to output a deferred bang every time it is reloaded?

The obvjous way doesn't do anything.

If I create a JS object with the following code (and only the following code) in it, I expect it output the message "reloaded" out an outlet, and to post the message "FUNCTION CALL", "reloaded" to the post window. Howener, nothing happens.

Why?

new Task(
    function() {
        post("FUNCTION CALL", "reloaded");post();
        this.outlet(0, "reloaded");
    ;}, this
).schedule(1);