mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[REF] owl: move some exported values around
This is a breaking change. Code using Observer, EventBus, Store or
ConnectedComponent need to update the way they import theses classes.
- Observer is now in owl.misc (so you can import it like this:
const Observer = owl.misc.Observer;)
- EventBus is also now in owl.misc
- Store and ConnectedComponent are now together in store
This commit is contained in:
+6
-3
@@ -5,9 +5,10 @@
|
|||||||
* Note that dynamic values, such as a date or a commit hash are added by rollup
|
* Note that dynamic values, such as a date or a commit hash are added by rollup
|
||||||
*/
|
*/
|
||||||
export { Component } from "./component";
|
export { Component } from "./component";
|
||||||
export { EventBus } from "./event_bus";
|
import { EventBus } from "./event_bus";
|
||||||
export { Observer } from "./observer";
|
import { Observer } from "./observer";
|
||||||
|
|
||||||
|
export const misc = {EventBus, Observer};
|
||||||
// we need to import manually the extra directives so they can register
|
// we need to import manually the extra directives so they can register
|
||||||
// themselves in QWeb, otherwise these files will not even be loaded.
|
// themselves in QWeb, otherwise these files will not even be loaded.
|
||||||
import "./qweb_directives";
|
import "./qweb_directives";
|
||||||
@@ -15,7 +16,9 @@ import "./qweb_extensions";
|
|||||||
import { QWeb } from "./qweb_core";
|
import { QWeb } from "./qweb_core";
|
||||||
export { QWeb };
|
export { QWeb };
|
||||||
|
|
||||||
export { Store, ConnectedComponent } from "./store";
|
import { Store, ConnectedComponent } from "./store";
|
||||||
|
|
||||||
|
export const store = {Store, ConnectedComponent};
|
||||||
import * as _utils from "./utils";
|
import * as _utils from "./utils";
|
||||||
|
|
||||||
export const __info__ = {};
|
export const __info__ = {};
|
||||||
|
|||||||
+3
-1
@@ -1,7 +1,9 @@
|
|||||||
import { Component, Env } from "../src/component";
|
import { Component, Env } from "../src/component";
|
||||||
import { Store, ConnectedComponent } from "../src/store";
|
import { Store, ConnectedComponent } from "../src/store";
|
||||||
import { makeTestFixture, makeTestEnv, nextMicroTick, nextTick } from "./helpers";
|
import { makeTestFixture, makeTestEnv, nextMicroTick, nextTick } from "./helpers";
|
||||||
import { Observer } from "../src";
|
import { misc } from "../src";
|
||||||
|
|
||||||
|
const Observer = misc.Observer;
|
||||||
|
|
||||||
describe("basic use", () => {
|
describe("basic use", () => {
|
||||||
test("commit a mutation", () => {
|
test("commit a mutation", () => {
|
||||||
|
|||||||
@@ -338,7 +338,7 @@ function makeStore() {
|
|||||||
todos,
|
todos,
|
||||||
nextId
|
nextId
|
||||||
};
|
};
|
||||||
const store = new owl.Store({
|
const store = new owl.store.Store({
|
||||||
state,
|
state,
|
||||||
actions,
|
actions,
|
||||||
mutations
|
mutations
|
||||||
@@ -405,7 +405,7 @@ class TodoItem extends owl.Component {
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// TodoApp
|
// TodoApp
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
class TodoApp extends owl.ConnectedComponent {
|
class TodoApp extends owl.store.ConnectedComponent {
|
||||||
components = { TodoItem };
|
components = { TodoItem };
|
||||||
state = { filter: "all" };
|
state = { filter: "all" };
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user