A.file
function Carousel(){
~~~~~~ code ~~~~~~
this.add = function(data){
do_something()
self.addCallback.call(this, arguments)
};
this.remove = function(data){
do_something()
this.removeCallback.call(this, arguments)
};
~~~~~~ code ~~~~~~
}
Carousel.prototype.addCallback = function(){};
Carousel.prototype.removeCallback = function(){};
B.file
carousel = new Carousel();
carousel.addCallback = (function(data){
// I want the data from A.file, but i can't ! heeeeeelp~
do_something(data)
carousel.addCallback()
do_something(data)
})();
The issue lies in retrieving the data
from A.file in B.file.
In my scenario, I require adding some callbacks after creating or removing actions.
Is this approach correct? Could anyone provide additional tips, techniques, or corrections to the above problem? Any insights would be greatly appreciated.