keeping track of multiple runs of the same function, part 2

Posted by qwertymk on Stack Overflow See other posts from Stack Overflow or by qwertymk
Published on 2011-02-04T06:45:11Z Indexed on 2011/02/04 7:25 UTC
Read the original article Hit count: 162

Filed under:
|
|
|
|

This is related to this

Anyway what I need is actually something slightly different I need some way of doing this:

function run(arg) {
    this.ran = this.ran || false;
    if (!this.ran) init;
    /* code */
    this.ran = true;
}

This works fine, I just want to make sure that this code works even when this in case it was called with call() or apply()

Check this out for what I'm talking about, All of the calls after the first one should all be true, no matter the context

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about function