Skip to content

Commit

Permalink
Merge pull request #474 from foretagsplatsen/15549487/Remove_initiali…
Browse files Browse the repository at this point in the history
…ze_methods_from_Widget2

15549487: Remove _initialize methods from Widget2
  • Loading branch information
JohanBriglia committed Mar 21, 2024
2 parents f27e703 + 9beecd0 commit f37a329
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions src/Widget2.js
Expand Up @@ -12,17 +12,17 @@ import { newId } from "./idGenerator.js";
* @example
*
* class TitleWidget extends Widget {
* _initialize(spec) {
* this._title = spec.title || "Hello World";
* constructor({ title }) {
* this._title = title || "Hello World";
* }
*
* renderContentOn(html) {
* html.h1(title);
* html.h1(this._title);
* }
*
* };
*
* let helloWorldWidget = new TitleWidget({title: "Hello Widget!"});
* let helloWorldWidget = new TitleWidget({ title: "Hello Widget!" });
*
* $(document).ready(() => {
* helloWorldWidget.appendTo("BODY");
Expand Down Expand Up @@ -79,24 +79,8 @@ export default class Widget2 {
this._getParameters = this._router.getParameters;
this._getParameter = this._router.getParameter;
this._setParameters = this._router.setParameters;

this._initialize(...arguments);
this._initializeSubwidgets(...arguments);
}

/**
* Hook evaluated at the beginning of initialization. Always
* implement initialization code in overrides of this method (or
* of `_initializeSubwidgets()`). In particular, don't override
* `constructor()`.
*/
_initialize(_spec) {}

/**
* Hook evaluated at the end of initialization.
*/
_initializeSubwidgets(_spec) {}

//
// Public
//
Expand Down

0 comments on commit f37a329

Please sign in to comment.