Knockout.js has an extension point to allow you to Customise the disposal of your bindings.

However, when these callbacks are executed they are wrapped in a try…. finally. The relevant method in the stacktrace is shown below:

ignore: function (callback, callbackTarget, callbackArgs) {
    try {
        begin();
        return callback.apply(callbackTarget, callbackArgs || []);
    } finally {
        end();
    }
}

So if you have any exceptions in your callback, they are quietly swallowed, no console logs, no console errors, everything is hunky dory! And bugs abound….

Next time you can’t figure out why your bindings are not working, try check the dependencyInjection, and perhaps this will save you creating a fiddle to solve a non-existent problem!



This post was originally published on Entelect’s internal Tech Blog, Yoda.