access main class attributes from sub class callback in javascript

Viewed 50

Javascript code i want to use this.progressbar inside media callback function

  class CatMusicPlayer {

  constructor(url,playPauseBtn,progressbar,progressTime,durationTime) {
    this.url = url;
    this.playPauseBtn = playPauseBtn;
    this.progressbar = progressbar;
    this.progressTime = progressTime;
    this.durationTime = durationTime;

    new Media(url,null,this.logerror,function(mediaStatus){

        /*
            i want to use this.progressbar,
            but in this block "this" reffers to Media class.
            Media is kind of another class similar to CatMusicPlayer
        */

    });
  }
2 Answers
Related