Files
owl/README.md
T

75 lines
2.4 KiB
Markdown
Raw Normal View History

2019-04-18 10:18:53 +02:00
<h1 align="center">🦉 Odoo Web Library 🦉</h1>
2019-01-17 18:08:39 +01:00
## Project Overview
The Odoo Web Library (OWL) is a small
UI framework intended to be the basis for the [Odoo](https://www.odoo.com/) Web Client, and hopefully many
other Odoo related projects. OWL's two key features are:
2019-03-27 15:26:20 +01:00
- a declarative component system, with QWeb as a template engine, asynchronous rendering, and an underlying virtual dom,
- and a store (state management solution, loosely inspired by VueX and React/Redux).
2019-04-23 11:46:08 +02:00
If you are interested, you can find a discussion on what makes OWL different
from React and Vue [here](doc/comparison.md)
2019-04-23 11:46:08 +02:00
## Try it online!
An online playground is available at [https://odoo.github.io/owl/](https://odoo.github.io/owl/) to let you experiment with the OWL framework.
# Example
Here is a short example to illustrate interactive widgets:
2019-03-27 15:40:24 +01:00
```javascript
class ClickCounter extends owl.Component {
2019-03-27 15:40:24 +01:00
inlineTemplate = `
<button t-on-click="increment">
Click Me! [<t t-esc="state.value"/>]
</button>`;
2019-03-27 15:40:24 +01:00
constructor(parent, props) {
super(parent, props);
2019-04-23 11:46:08 +02:00
this.state = { value: 0 };
2019-03-27 15:40:24 +01:00
}
2019-04-23 11:46:08 +02:00
increment() {
this.state.value++;
2019-03-27 15:40:24 +01:00
}
}
const qweb = new owl.QWeb();
const counter = new ClickCounter({qweb});
counter.mount(document.body);
```
2019-03-27 16:42:21 +01:00
More interesting examples can be found on the [playground](https://odoo.github.io/owl/) application.
2019-03-27 15:40:24 +01:00
## Installing/Building
2019-03-27 15:40:24 +01:00
If you want to use a simple `<script>` tag, the last release can be downloaded here:
2019-03-27 15:40:24 +01:00
- [owl-0.7.0.js](https://odoo.github.io/owl/releases/owl-0.7.0.js)
- [owl-0.7.0.min.js](https://odoo.github.io/owl/releases/owl-0.7.0.min.js)
Some npm scripts are available:
| Command | Description |
| -------------------- | -------------------------------------------------- |
| `npm install` | install every dependency required for this project |
| `npm run build` | build a bundle of _owl_ in the _/dist/_ folder |
| `npm run minify` | minify the prebuilt owl.js file |
| `npm run test` | run all tests |
| `npm run test:watch` | run all tests, and keep a watcher |
## Documentation
The complete documentation can be found [here](doc/readme.md). The most important sections are:
- [Quick Start](doc/quick_start.md)
- [Component](doc/component.md)
- [Store](doc/store.md)
## License
2019-04-04 15:33:46 +02:00
OWL is [GPL licensed](./LICENSE).