diff --git a/extras/playground/samples.js b/extras/playground/samples.js index e55def1c..39078d79 100644 --- a/extras/playground/samples.js +++ b/extras/playground/samples.js @@ -1,17 +1,17 @@ const CLICK_COUNTER = `class ClickCounter extends owl.Component { - constructor() { - super(...arguments); - this.template = "clickcounter"; - this.state = {value: 0}; - } + constructor() { + super(...arguments); + this.template = "clickcounter"; + this.state = { value: 0 }; + } - increment() { - this.state.value++; - } + increment() { + this.state.value++; + } } const qweb = new owl.QWeb(TEMPLATES); -const counter = new ClickCounter({qweb}); +const counter = new ClickCounter({ qweb }); counter.mount(document.body); `; @@ -29,50 +29,50 @@ const CLICK_COUNTER_CSS = `button { const CLICK_COUNTER_ESNEXT = `// This example will not work if your browser does not support ESNext class fields class ClickCounter extends owl.Component { - template = "clickcounter"; - state = {value: 0}; + template = "clickcounter"; + state = { value: 0 }; - increment() { - this.state.value++; - } + increment() { + this.state.value++; + } } const qweb = new owl.QWeb(TEMPLATES); -const counter = new ClickCounter({qweb}); +const counter = new ClickCounter({ qweb }); counter.mount(document.body); `; const WIDGET_COMPOSITION = `class ClickCounter extends owl.Component { - constructor(parent, props) { - super(parent, props); - this.template = "clickcounter"; - this.state = {value: props.initialState || 0}; - } + constructor(parent, props) { + super(parent, props); + this.template = "clickcounter"; + this.state = { value: props.initialState || 0 }; + } - increment() { - this.state.value++; - } + increment() { + this.state.value++; + } } - let nextId = 1; class App extends owl.Component { - constructor() { - super(...arguments); - this.template = "app"; - this.state = {counters: []} - this.widgets = { ClickCounter }; - } + constructor() { + super(...arguments); + this.template = "app"; + this.state = { counters: [] } + this.widgets = { ClickCounter }; + } - addCounter() { - this.state.counters.push(nextId++); - } + addCounter() { + this.state.counters.push(nextId++); + } } const qweb = new owl.QWeb(TEMPLATES); -const app = new App({qweb}); -app.mount(document.body);`; +const app = new App({ qweb }); +app.mount(document.body); +`; const WIDGET_COMPOSITION_XML = `