Question

I need to listen to ready events from a JS object (wavesurfer.js). I initialize the object with:

var wavesurfer = context['WaveSurfer'];

And call its init function with:

wavesurfer.callMethod('init', [mapOptions]);

But I'm unable to listen on ready events like in this JS code:

wavesurfer.on('ready', function () {
   wavesurfer.play();
});

I found solutions for similar problems like here but all are using functions that appear deprecated such as js package's scoped() and Callback.many().

Any pointers are appreciated.

Was it helpful?

Solution

With dart:js :

wavesurfer.callMethod('on', ['ready', () {
  wavesurfer.callMethod('play');
}]);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top