function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Andrew EAndrew E 

Creating/calling a global method from Application

Hi all,

I'm building a Lightning application on VisualForce composes of several components. I have one component that is a spinner so every component has its own "showspinner" and "hidespinner" function that calls an Event which is handled by a listener on the VisualForce page to show/hide the spinner. There are a few more functions that all my components have and call on when necessary.

I'm wondering, is this bad design? This makes each component independent as it can be re-used without depending on other components, but it's a lot of repetitive code in my application. Does anyone have any suggestions? I'm thinking if I can somehow create a global method, I can just call it with one line from each component.