photoBrowser Cannot read property 'params' of undefined

  var myPhotoBrowserDark = app.photoBrowser.create({
    photos,
    theme: 'dark',
  });
  $$('.pb').on('click', function () {
    var photoIndex = $$(this).attr("data-index");
    myPhotoBrowserDark.open(photoIndex);
  });

myPhotoBrowserDark.params.photos.push(imgUrl);

V 5.2.0

I make it work now by replace

myPhotoBrowserDark.params.photos.push(imgUrl);
to
photos.push(imgUrl);

Thank you