Abstract Snowboard plugin constructors and destructors#561
Merged
bennothommo merged 3 commits intodevelopfrom May 19, 2022
Merged
Abstract Snowboard plugin constructors and destructors#561bennothommo merged 3 commits intodevelopfrom
bennothommo merged 3 commits intodevelopfrom
Conversation
Previously, Snowboard plugins had been written to append the main JavaScript constructor. While this worked, it prevented the ability to destruct the plugin during construction (ie. prevent double initialisation on plugins, for example), as the "detach" method which is fired on destruction is added *after* construction. This change abstracts the constructor and destructor to separate methods run after the true construction of the JavaScript object is complete. A bonus is that the constructor no longer needs to include "snowboard" as one of the parameters - this instead is done on the true construction.
This should make the Snowboard constructor changes backwards-compatible.
LukeTowers
added a commit
that referenced
this pull request
Jul 15, 2022
* develop: (65 commits) Update maximum supported PHP version for 1.1 (#603) Update EditorConfig link (#602) Apply consistent path normalisation to fix Windows test Fix view maker unit test for Windows Outputs time respecting backend preferences (#572) Rebuild Snowboard agian Revert "Rebuild Snowboard" Rebuild Snowboard Allow a string selector for the form in a request Use correct line breaks for Windows tests Backport ViewMaker tests from 1.2 branch farsi spelling correction (#579) Add Winter 1.2 as version option in bug report Adjust early termination of requests from success/error Increase stale check to 6 months Let composer resolve current php process in scripts (#563) Fix track input not keeping timeout Add jQuery AJAX prefilter as early as possible Add additional debugging for errors thrown in events Abstract Snowboard plugin constructors and destructors (#561) ... # Conflicts: # composer.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, Snowboard plugins had been written to append the main JavaScript constructor. While this worked, it prevented the ability to destruct the plugin during construction (ie. prevent double initialisation on plugins, for example), as the "detach" method which is fired on destruction is added after construction.
This change abstracts the constructor and destructor to separate methods run after the true construction of the JavaScript object is complete. A bonus is that the constructor no longer needs to include "snowboard" as one of the parameters - this instead is done on the true construction.
This is technically a breaking change, as parameters are not passed to the true constructor anymore, but instead passed to the new(no longer valid as of d1f740c). People who have written Snowboard plugins will need to replaceconstructmethodconstructor()withconstruct(), anddestructor()withdestruct()in their plugins. Theconstruct()method no longer needs Snowboard as the first parameter, so this can be dropped.In addition, if they call the
super()method within their constructor, they will need to change this tosuper.construct()instead.