I’ve just ported an old plugin to a theme-component. It had both an Ember service, and a component. The current plugin API has a modifyClass
function, but no way to register new classes (as far as I can tell).
I created this function, mimicking the existing modifyClass
function (example use here):
function registerClass(resolverName, definition) {
const alreadyRegistered = Discourse.hasRegistration(resolverName)
if (alreadyRegistered) {
console.warn(`"${resolverName}" is already registered`);
return;
}
Discourse.register(resolverName, definition)
}
Is this the correct approach to be taking? And if so, is this something that could be added to the plugin API?
If so I will submit a pull request