Click Me!
@@ -152,7 +147,6 @@ const ANIMATION_CSS = `button {
const LIFECYCLE_DEMO = `class HookWidget extends owl.Component {
constructor() {
super(...arguments);
- this.template = "demo.hookwidget";
this.state = { n: 0 };
console.log("constructor");
}
@@ -183,7 +177,6 @@ class ParentWidget extends owl.Component {
constructor() {
super(...arguments);
this.widgets = { HookWidget };
- this.template = "demo.parentwidget";
this.state = { n: 0, flag: true };
}
increment() {
@@ -200,14 +193,14 @@ widget.mount(document.body);
`;
const LIFECYCLE_DEMO_XML = `
-
+
Increment
ToggleSubWidget
-
-
Demo Sub Widget. Props: . State: . (click on me to update me)
+
+ Demo Sub Widget. Props: . State: . (click on me to update me)
`;
const BENCHMARK_APP = `//------------------------------------------------------------------------------
@@ -241,7 +234,6 @@ for (let i = 1; i < 16000; i++) {
class Counter extends owl.Component {
constructor(parent, props) {
super(parent, props);
- this.template = "counter";
this.state = { counter: props.initialState || 0 };
}
@@ -256,7 +248,6 @@ class Counter extends owl.Component {
class Message extends owl.Component {
constructor() {
super(...arguments);
- this.template = "message";
this.widgets = { Counter };
}
@@ -273,7 +264,6 @@ class Message extends owl.Component {
class App extends owl.Component {
constructor() {
super(...arguments);
- this.template = "root";
this.widgets = { Message };
this.state = { messages: messages.slice(0, 10) };
}
@@ -351,7 +341,7 @@ const BENCHMARK_APP_CSS = `.main {
}`;
const BENCHMARK_APP_XML = `
-
+
-
@@ -374,14 +364,14 @@ const BENCHMARK_APP_XML = `
-
+
Remove
-
+
-
Value:
+
@@ -477,7 +467,6 @@ function makeStore() {
// TodoItem
//------------------------------------------------------------------------------
class TodoItem extends owl.Component {
- template = "todoitem";
state = { isEditing: false };
removeTodo() {
@@ -536,7 +525,6 @@ function mapStateToProps(state) {
}
class TodoApp extends owl.Component {
- template = "todoapp";
widgets = { TodoItem };
state = { filter: "all" };
@@ -603,7 +591,7 @@ app.mount(document.body);
`;
const TODO_APP_STORE_XML = `
-
+
-
+
@@ -1035,39 +1023,25 @@ html .clear-completed:active {
}
`;
-const RESPONSIVE = `class Navbar extends owl.Component {
- template="navbar";
-}
+const RESPONSIVE = `class Navbar extends owl.Component {}
class ControlPanel extends owl.Component {
- template="controlpanel";
widgets = { MobileSearchView };
}
class FormView extends owl.Component {
- template="formview";
widgets = { AdvancedWidget };
}
-class AdvancedWidget extends owl.Component {
- template="advancedwidget";
-}
+class AdvancedWidget extends owl.Component {}
-class Chatter extends owl.Component {
- template="chatter";
-}
+class Chatter extends owl.Component {}
-class MobileSearchView extends owl.Component {
- template="mobilesearchview";
-}
+class MobileSearchView extends owl.Component {}
class App extends owl.Component {
- constructor() {
- super(...arguments);
- this.template = "app";
- this.widgets = { Navbar, ControlPanel, FormView, Chatter };
- }
+ widgets = { Navbar, ControlPanel, FormView, Chatter };
}
function isMobile() {
@@ -1082,39 +1056,39 @@ const env = {
const app = new App(env);
app.mount(document.body);
-window.addEventListener(
- "resize",
- owl.utils.debounce(function() {
- const _isMobile = isMobile();
- if (_isMobile !== env.isMobile) {
- app.updateEnv({
- isMobile: _isMobile
- });
- }
- }, 20)
-);`;
+function updateEnv() {
+ const _isMobile = isMobile();
+ if (_isMobile !== env.isMobile) {
+ app.updateEnv({
+ isMobile: _isMobile
+ });
+ }
+}
+
+window.addEventListener("resize", owl.utils.debounce(updateEnv, 20));
+`;
const RESPONSIVE_XML = `
- Navbar
+ Navbar
-