Parameterizing variable call backs for a chain of asynchronous functions in javascript, jQuery

Viewed 105

I have a number for functions of the form:

function A() {
    asychProcessA(
        someCallBack();
    )
}

function B() {
    asychProcessB(
        someCallBack();
    )
}

function C () {
    asychProcessC(
        someCallBack();
    )
}

Some times I will want to implement these functions in series like:

function A() {
    asychProcessA(
        functionB();
    )
}

But I also want the option of implementing one of these individually with some other callback like

function A() {
    asychProcessA(
        someOtherCallBack();
    )
}

Can some one suggest an elegant and versatile way to set this up. I am using jQuery in this project so that's fair game.

1 Answers
Related