I'm trying to send a callback from a javascript class to its object. I haven't gotten anywhere with it.
class MyClass {
constructor(param1, param2) {
// trigger the callback
this.callback();
}
}
obj = MyClass({
parameter1: 'test',
parameter2: 'test',
callback() {
alert('callback received');
}
});
new MyClasswith an argument, but have no parameters onconstructor... the arguments passed innew MyClasswill be parameters on theconstructor