Prevent app from destroying their notification

Problem

some apps (chrome) destroy their notification from notification tray whenever they gain focus.
I want prevent them from destroying those

extension workaround

this extension is supopsed to fix it
https://extensions.gnome.org/extension/1335/grown-up-notifications/

However its outdated (gnome shell 3.38) and I can’t get it to work on gnome shell 42.9

I have tried messing around with the extension.js without success:

const MessageTray = imports.ui.messageTray;

let oldDestroy;

function _destroy(reason) {
  if (reason != 3) {
    oldDestroy.call(this);
  }
}

function init() {
  oldDestroy = MessageTray.Notification.prototype.destroy;
}

function enable() {
  MessageTray.Notification.prototype.destroy = _destroy;
}

function disable() {
  MessageTray.Notification.prototype.destroy = oldDestroy;
}

I guess the message tray API has changed, anybody could help me updating it or giving me pointer to the documentation related to this ? thanks

There’s a little bit of usage documentation on gjs.guide, but no documentation on modifying the notification system.

You’ll probably want to poke around messageTray.js and notificationDaemon.js to see why overriding destroy() isn’t working.