mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
buildData,
|
||||
startMeasure,
|
||||
stopMeasure,
|
||||
formatNumber
|
||||
} from "../shared/utils.js";
|
||||
import { buildData, startMeasure, stopMeasure, formatNumber } from "../shared/utils.js";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Likes Counter Widget
|
||||
@@ -40,11 +35,7 @@ class App extends owl.Component {
|
||||
state = { messages: [], multipleFlag: false, clearAfterFlag: false };
|
||||
|
||||
mounted() {
|
||||
this.log(
|
||||
`Benchmarking Owl v${owl.__info__.version} (build date: ${
|
||||
owl.__info__.date
|
||||
})`
|
||||
);
|
||||
this.log(`Benchmarking Owl v${owl.__info__.version} (build date: ${owl.__info__.date})`);
|
||||
}
|
||||
|
||||
benchmark(message, fn, callback) {
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
buildData,
|
||||
startMeasure,
|
||||
stopMeasure,
|
||||
formatNumber
|
||||
} from "../shared/utils.js";
|
||||
import { buildData, startMeasure, stopMeasure, formatNumber } from "../shared/utils.js";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Likes Counter Widget
|
||||
@@ -40,11 +35,7 @@ class App extends owl.Component {
|
||||
state = { messages: [], multipleFlag: false, clearAfterFlag: false };
|
||||
|
||||
mounted() {
|
||||
this.log(
|
||||
`Benchmarking Owl v${owl.__info__.version} (build date: ${
|
||||
owl.__info__.date
|
||||
})`
|
||||
);
|
||||
this.log(`Benchmarking Owl v${owl.__info__.version} (build date: ${owl.__info__.date})`);
|
||||
}
|
||||
|
||||
benchmark(message, fn, callback) {
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
buildData,
|
||||
startMeasure,
|
||||
stopMeasure,
|
||||
formatNumber
|
||||
} from "../shared/utils.js";
|
||||
import { buildData, startMeasure, stopMeasure, formatNumber } from "../shared/utils.js";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Likes Counter Widget
|
||||
@@ -40,11 +35,7 @@ class App extends owl.Component {
|
||||
state = { messages: [], multipleFlag: false, clearAfterFlag: false };
|
||||
|
||||
mounted() {
|
||||
this.log(
|
||||
`Benchmarking Owl v${owl.__info__.version} (build date: ${
|
||||
owl.__info__.date
|
||||
})`
|
||||
);
|
||||
this.log(`Benchmarking Owl v${owl.__info__.version} (build date: ${owl.__info__.date})`);
|
||||
}
|
||||
|
||||
benchmark(message, fn, callback) {
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
buildData,
|
||||
startMeasure,
|
||||
stopMeasure,
|
||||
formatNumber
|
||||
} from "../shared/utils.js";
|
||||
import { buildData, startMeasure, stopMeasure, formatNumber } from "../shared/utils.js";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Likes Counter Widget
|
||||
@@ -40,11 +35,7 @@ class App extends owl.Component {
|
||||
state = { messages: [], multipleFlag: false, clearAfterFlag: false };
|
||||
|
||||
mounted() {
|
||||
this.log(
|
||||
`Benchmarking Owl v${owl.__info__.version} (build date: ${
|
||||
owl.__info__.date
|
||||
})`
|
||||
);
|
||||
this.log(`Benchmarking Owl v${owl.__info__.version} (build date: ${owl.__info__.date})`);
|
||||
}
|
||||
|
||||
benchmark(message, fn, callback) {
|
||||
@@ -128,9 +119,7 @@ class App extends owl.Component {
|
||||
|
||||
removeMessage(event) {
|
||||
this.benchmark("remove message", () => {
|
||||
const index = this.state.messages.findIndex(
|
||||
m => m.id === event.detail.id
|
||||
);
|
||||
const index = this.state.messages.findIndex(m => m.id === event.detail.id);
|
||||
this.state.messages.splice(index, 1);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ let nextId = 1;
|
||||
export function buildData(n = 1000) {
|
||||
const data = [];
|
||||
for (let i = 0; i < n; i++) {
|
||||
let id = nextId++;
|
||||
let id = nextId++;
|
||||
data.push({
|
||||
id: id,
|
||||
author: chooseRandomly(AUTHORS),
|
||||
@@ -32,7 +32,7 @@ export function buildData(n = 1000) {
|
||||
// Measuring helpers
|
||||
//------------------------------------------------------------------------------
|
||||
export function formatNumber(n) {
|
||||
return Number(n).toFixed();
|
||||
return Number(n).toFixed();
|
||||
}
|
||||
|
||||
let startTime;
|
||||
@@ -51,7 +51,7 @@ export function stopMeasure(cb) {
|
||||
const msg = `[${last}] took ${formatNumber(delta)}ms`;
|
||||
console.log(msg);
|
||||
if (cb) {
|
||||
cb({msg, delta});
|
||||
cb({ msg, delta });
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
|
||||
@@ -97,10 +97,7 @@ function makeCodeIframe(js, css, xml, errorHandler) {
|
||||
setTimeout(function() {
|
||||
if (iframe.contentWindow) {
|
||||
iframe.contentWindow.removeEventListener("error", errorHandler);
|
||||
iframe.contentWindow.removeEventListener(
|
||||
"unhandledrejection",
|
||||
errorHandler
|
||||
);
|
||||
iframe.contentWindow.removeEventListener("unhandledrejection", errorHandler);
|
||||
}
|
||||
}, 200);
|
||||
doc.body.appendChild(script);
|
||||
|
||||
@@ -1351,7 +1351,7 @@ export const SAMPLES = [
|
||||
description: "Lifecycle demo",
|
||||
code: LIFECYCLE_DEMO,
|
||||
xml: LIFECYCLE_DEMO_XML,
|
||||
css: LIFECYCLE_CSS,
|
||||
css: LIFECYCLE_CSS
|
||||
},
|
||||
{
|
||||
description: "Todo List App (with store)",
|
||||
|
||||
Reference in New Issue
Block a user