I'm facing an issue where a modified function is not being called.
The original implementation is shown below.
// Base file defining and exporting a function
function a() {
// do something
}
module.exports = {
a: a,
b: function () {
$('body').on('some_event', function (e, response) {
// do something
// call a
a();
});
}
}
The override looks like this.
// Overriding the function a()
var base = require('mystuff/base');
function a() {
// overridden implementation
}
base.a = a;
module.exports = base;
When some_event
occurs on the page, b()
runs and ultimately calls a()
, but it executes the base implementation rather than the overridden one.
How can I resolve this so that the overridden function is executed when the event is triggered? The goal is for b()
to run and then execute the overridden a()
in its final step.