FuseJS Component with Model Question


I have a component that displays messages to the user called UserFeedback. It has its own model. The model has methods like setMessage, hideMessage, isVisible.

Given that the model is instantiated from the class definition by the UX, is there a way for me to access these methods from other javascript code in the application? For example, in a LoginPage.js, can I somehow get the UserFeedback model instance, and call its setMessage method?

I’m guessing the answer is ‘no’, but I thought I’d ask in case I am misunderstanding how the new FuseJS works. Right now it seems like I would have to create an event and then have the UserFeedback.ux handle that event to set its own state to the desired values.

Thanks in advance for the help!

This sounds like you could have a common service module that you import in both your app model, and the component model.

Your component model then could be reactively tied to the variables in the service model, and once they change, the component would react.