Generic Functions

suggest change

In interfaces:

interface IRunner {
    runSafe<T extends IRunnable>(runnable: T): void;
}

In classes:

class Runner implements IRunner {

    public runSafe<T extends IRunnable>(runnable: T): void {
        try {
            runnable.run();
        } catch(e) {
        }
    }

}

Simple functions:

function runSafe<T extends IRunnable>(runnable: T): void {
    try {
        runnable.run();
    } catch(e) {
    }
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents