Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

15549487: Remove _initialize methods from Widget2 #474

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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