How to get topic slug or id from PluginAPI?

PluginAPI newbie here. I have a working script something like:

api.decorateCooked($elem => {
    var iframes = $elem[0].querySelectorAll('iframe');
    var uri = $elem[0].baseURI;
    // modify the iframes in a way that depends on the topic
});

I’m using the uri as a key into another database to know how to modify the iframes. However I think this will break if the topic is moved; in any case I would prefer to use the topic id or slug. Is there a way to get those from the PluginAPI?