Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
d3fd269
[IMP] introduce signals and derived values
Goaman Sep 26, 2025
4f3b34d
[ref] update package-lock.json
ged-odoo Nov 20, 2025
af4bf29
[rel] update package.json
ged-odoo Nov 21, 2025
dd9331c
[ADD] add registry and plugin system
ged-odoo Nov 20, 2025
bc6b219
[notes] add release notes
ged-odoo Nov 24, 2025
edac61a
[rel] update package.json to 3.0.0-alpha.2
ged-odoo Nov 24, 2025
e75ad49
[imp] improve typing, fix registry validation code
ged-odoo Nov 24, 2025
a9a622b
[rel] update version to alpha.4
ged-odoo Nov 24, 2025
983b19d
[fix] registry: make it work, add addById method
ged-odoo Nov 24, 2025
76c1fe6
v3.0.0-alpha.5
ged-odoo Nov 24, 2025
9768284
[REM] utils: remove loadFile
ged-odoo Dec 2, 2025
3873dbb
[ref] signals: change their api
ged-odoo Dec 2, 2025
28b9778
[ref] plugins: change api
mcm-odoo Dec 2, 2025
547f9a5
[IMP] plugins: test with components
mcm-odoo Dec 2, 2025
7e5d7ee
[FIX] plugins: fix resource tests
mcm-odoo Dec 2, 2025
f911d07
[ref] utils: rename useExternalListener to useListener
ged-odoo Dec 2, 2025
637d1cd
[ref] rename useState/reactive => proxy
ged-odoo Dec 2, 2025
b048237
[imp] update package.json dev dependencies
ged-odoo Dec 2, 2025
4a5a44d
[imp] streamline app API (Root/subroots => roots)
mcm-odoo Dec 2, 2025
3822372
[fix] various fixes to make the previous commits work
ged-odoo Dec 2, 2025
eb7c5b3
[FIX] playground: fix playground
mcm-odoo Dec 4, 2025
d42c40e
[FIX] revamp error handling code, only throw error once in some cases
ged-odoo Dec 3, 2025
69f0944
[IMP] reactivity: add Signal.update method
ged-odoo Dec 4, 2025
bfc993d
[REF] runtime: move code around to make it clearer
ged-odoo Dec 4, 2025
60e3c37
[REF] reactivity: split code into multiple files
ged-odoo Dec 4, 2025
4064200
[REF] rename withoutReactivity => untrack
ged-odoo Dec 4, 2025
fef3653
[REF] reactivity: move tests
ged-odoo Dec 4, 2025
c88dc5a
[REF] mini cleanup, remove commont/types file
ged-odoo Dec 4, 2025
df49ea8
[IMP] app: remove warnIfNoStaticProps
mcm-odoo Dec 8, 2025
bd1e386
[FIX] app: fix mount return type
mcm-odoo Dec 8, 2025
6092e92
[IMP] props: introduce props function
mcm-odoo Dec 8, 2025
24d5e8e
[IMP] prettify
mcm-odoo Dec 8, 2025
41bd855
[imp] add Resource, make registry chainable
ged-odoo Dec 8, 2025
5730579
[IMP] add Registry.remove, Resource.remove, rename Registry.get => Re…
ged-odoo Dec 8, 2025
bb236df
update snapshots
ged-odoo Dec 8, 2025
ae9b214
[imp] error: simplify error handling
ged-odoo Dec 8, 2025
724c3c9
[imp] simplify plugin and resources system
ged-odoo Dec 9, 2025
465a76b
[add] add some tests for resource
ged-odoo Dec 9, 2025
802b740
[IMP] props: improve props types again
mcm-odoo Dec 9, 2025
7fc0b79
[IMP] hooks: remove env related hooks
mcm-odoo Dec 9, 2025
71efb0d
[IMP] hooks: remove env related hooks
mcm-odoo Dec 9, 2025
939164f
[IMP] props: move default props to props function
mcm-odoo Dec 9, 2025
ff9a28a
[REF] slot: rename t-slot into t-call-slot
mcm-odoo Dec 9, 2025
a906170
[rem] remove onWillRender and onRendered
ged-odoo Dec 9, 2025
d201c12
wip
ged-odoo Dec 9, 2025
ed9f1d6
wip
ged-odoo Dec 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions doc/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,14 @@ Other hooks:
- [`useComponent`](reference/hooks.md#usecomponent): return a reference to the current component (useful to create derived hooks)
- [`useEffect`](reference/hooks.md#useeffect): define an effect with its dependencies
- [`useEnv`](reference/hooks.md#useenv): return a reference to the current env
- [`useExternalListener`](reference/hooks.md#useexternallistener): add a listener outside of a component DOM
- [`useListener`](reference/hooks.md#uselistener): add a listener outside of a component DOM
- [`useRef`](reference/hooks.md#useref): get an object representing a reference (`t-ref`)
- [`useChildSubEnv`](reference/hooks.md#usesubenv-and-usechildsubenv): extend the current env with additional information (for child components)
- [`useSubEnv`](reference/hooks.md#usesubenv-and-usechildsubenv): extend the current env with additional information (for current component and child components)

Utility/helpers:

- [`EventBus`](reference/utils.md#eventbus): a simple event bus
- [`loadFile`](reference/utils.md#loadfile): an helper to load a file from the server
- [`markup`](reference/templates.md#outputting-data): utility function to define strings that represent html (should not be escaped)
- [`status`](reference/component.md#status-helper): utility function to get the status of a component (new, mounted or destroyed)
- [`validate`](reference/utils.md#validate): validates if an object satisfies a specified schema
Expand Down
2 changes: 1 addition & 1 deletion doc/reference/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ what it could look like in practice:

```js
// in the main js file:
const { loadFile, mount } = owl;
const { mount } = owl;

// async, so we can use async/await
(async function setup() {
Expand Down
8 changes: 4 additions & 4 deletions doc/reference/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- [`useState`](#usestate)
- [`useRef`](#useref)
- [`useSubEnv` and `useChildSubEnv`](#usesubenv-and-usechildsubenv)
- [`useExternalListener`](#useexternallistener)
- [`useListener`](#uselistener)
- [`useComponent`](#usecomponent)
- [`useEnv`](#useenv)
- [`useEffect`](#useeffect)
Expand Down Expand Up @@ -187,16 +187,16 @@ frozen, to prevent unwanted modifications.
Note that both these hooks can be called an arbitrary number of times. The `env`
will then be updated accordingly.

### `useExternalListener`
### `useListener`

The `useExternalListener` hook helps solve a very common problem: adding and removing
The `useListener` hook helps solve a very common problem: adding and removing
a listener on some target whenever a component is mounted/unmounted. It takes a target
as its first argument, forwards the other arguments to `addEventListener`. For example,
a dropdown menu (or its parent) may need to listen to a `click` event on `window`
to be closed:

```js
useExternalListener(window, "click", this.closeMenu, { capture: true });
useListener(window, "click", this.closeMenu, { capture: true });
```

### `useComponent`
Expand Down
16 changes: 0 additions & 16 deletions doc/reference/utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ functions are all available in the `owl.utils` namespace.
## Content

- [`whenReady`](#whenready): executing code when DOM is ready
- [`loadFile`](#loadfile): loading a file (useful for templates)
- [`EventBus`](#eventbus): a simple EventBus
- [`validate`](#validate): a validation function
- [`batched`](#batched): batch function calls
Expand All @@ -32,21 +31,6 @@ whenReady(function () {
});
```

## `loadFile`

`loadFile` is a helper function to fetch a file. It simply
performs a `GET` request and returns the resulting string in a promise. The
initial usecase for this function is to load a template file. For example:

```js
const { loadFile } = owl;

async function makeEnv() {
const templates = await loadFile("templates.xml");
// do something
}
```

## `EventBus`

It is a simple `EventBus`, with the same API as usual DOM elements, and an
Expand Down
28 changes: 18 additions & 10 deletions docs/playground/playground.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { debounce, loadJS } from "./utils.js";
import {
App,
Component,
useState,
proxy,
props,
useRef,
onMounted,
onWillUnmount,
onPatched,
onWillUpdateProps,
loadFile as _loadFile,
whenReady,
__info__,
useEffect,
onWillStart,
OwlError,
mount,
} from "../owl.js";

//------------------------------------------------------------------------------
Expand All @@ -32,7 +33,12 @@ const DEFAULT_XML = `<templates>
const fileCache = {};
const loadFile = (path) => {
if (!(path in fileCache)) {
fileCache[path] = _loadFile(path);
fileCache[path] = fetch(path).then((result) => {
if (!result.ok) {
throw new OwlError("Error while fetching xml templates");
}
return result.text();
});
}
return fileCache[path];
}
Expand Down Expand Up @@ -145,9 +151,11 @@ function loadSamples() {
// Tabbed editor
//------------------------------------------------------------------------------
class TabbedEditor extends Component {
props = props();

setup() {
const props = this.props;
this.state = useState({
this.state = proxy({
currentTab: props.js !== false ? "js" : props.xml ? "xml" : "css"
});
this.setTab = debounce(this.setTab.bind(this), 250, true);
Expand Down Expand Up @@ -252,7 +260,7 @@ class Playground extends Component {
this.version = __info__.version;

this.isDirty = false;
this.state = useState({
this.state = proxy({
js: "",
css: "",
xml: DEFAULT_XML,
Expand Down Expand Up @@ -394,10 +402,10 @@ async function start() {
loadFile("templates.xml"),
whenReady()
]);
const rootApp = new App(Playground, { name: "Owl Playground" });
rootApp.addTemplates(templates);

await rootApp.mount(document.body);
await mount(Playground, document.body, {
name: "Owl Playground",
templates,
});
}

start();
Loading