function onDoneHook(cb) {
        var prevCb = hooks['onDone'];
        hooks['onDone'] = function() {
            prevCb();
            cb();
        };
    }
Preserve and execute the functions in the order
the callbacks were registered