Ability to extend the Stimulus Application class
See original GitHub issueSummary
Class inheritance provides a way to achieve custom behaviour and it would be great to also allow this at the Application
level.
Currently, it is not easy to extend and use the Application
class without rewriting its static start
method.
Details
In the Application code, the start
static method references the Application
class directly instead of using this
.
This means that even if you extend the Application
with say a custom method override of load
, this custom method will never get used.
Proposal
Using this
instead of Application
should solve the issue.
static start(element?: Element, schema?: Schema): Application {
const application = new this(element, schema)
application.start()
return application
}
Use case
A trivial use case to add extra behaviour to the application stop call.
class MyApplication extends Application {
stop() {
super();
console.log('application stopped');
}
}
const application= MyApplication.start();
application.stop();
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Impact of Unemployment and Stimulus Payments on SSI/SSDI
During the pandemic, some eligibility requirements are being waived and some benefits are being extended or expanded. Always check with your state's ...
Read more >American Rescue Plan | The White House
Extend unemployment insurance · The American Rescue Plan extended unemployment benefits until September 6 with a weekly supplemental benefit of $300 on top...
Read more >Economic impact payments: What you need to know - IRS
Who is eligible for the economic impact payment? Tax filers with adjusted gross income up to $75,000 for individuals and up to $150,000...
Read more >Generalization ABA in the Classroom - SharpSchool
Generalization is the ability for a student to perform a skill under different conditions (stimulus generalization), the ability to apply a skill in...
Read more >COVID-19 Frequently Asked Questions
Q: Can WIOA formula and competitive grants continue to pay wages or ... Include details about how and why COVID-19 disruptions impact the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks. I still have this on my radar and hope to get a PR up when I get the chance.
PR up https://github.com/hotwired/stimulus/pull/603