mojito
mojito copied to clipboard
Sharable Addons Proposal
Addon instantiation time can add up in large applications. Perhaps we can share certain addons per request and even across requests. Addons would have a property that it can use to indicate whether it can be shared per requests or for all requests. By doing this certain addons such as the cookies addon can indicate that it can be shared per request and would only be instantiated once per request. Global addons that do not depend on requests would only be instantiated once per application.
This would not only cut down on addon instantiation time but would also limit the amount of memory used and garbage collection.
This is an interesting idea. At the very least I think it's worth doing some experiments to see how much of a benefit it might have.
The global structures that you're reference here ARE NOT action context, they need to be something else. ActionContext
addons are tied to an action executed on a mojit instance by definition, which means they will never be global. But I could not agree more that today people are using addons to mitigate a bigger problem, the lack of page-level structures that can be used by any mojit instance in the context of that page (independently or the runtime). We do have some ideas, and we will formalize them in the next few days, I will keep you posted.