Js framework | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula gr√°tis
+ 2

Js framework

Learning js in Odoo. Please see the below link. https://github.com/odoo/odoo/blob/13.0/addons/web/static/src/js/widgets/date_picker.js I would to know in odoo framework which library is used in the above code? And the above code format follows: 1) var Widget = require('web.Widget') 2) Object defined many user-defined functions. Default init() and start() method have all object. 3) Functions defined as: Functionname : myfunct(){ } I would like to know the above format which lib is using? Using object properties name can i able to get require package properties list. But unable to get predefined function used in that object how to get user defined method? Is any tutorial available for the above the js library framework? And underscore js library used in odoo framework is any courses available for this library in sololearn. Please share.

11th Feb 2020, 4:48 PM
Prakash Jain
Prakash Jain - avatar
2 Respostas
+ 1
anime js
22nd Feb 2020, 5:13 PM
Khaleed Ameen
Khaleed Ameen - avatar
I know this is an old post, but I will let this to help. Sorry for my bad English... Odoo uses its own undocumented framework. As far as I know it doesn't have name. Odoo 14 will come with a whole new front end framework named OWL (Odoo Web Library). It will use Typescript. But Odoo <= 13 uses this other framework. This Javascript framework is built on backbone.js and underscore. But There is no good official documentation or tutorial to learn this... You have to look a lot of code and examples to learn... To answer you some question: Why require? Odoo uses an module based javascript framework, I mean, odoo separate its code using modules. It's like python modules... They compile all the javascript files in just one file. every odoo.define("some.module") is a new module that odoo will register. odoo.define("some.module", function (require)) { require("other.module") } Require is an argument. You will use it to handle dependencies. (Other module will have the same form, and require will return the value that these function return...) In javascript everything is an object, so you functions are object, variable are objects. and a object has properties. And yes, a property can be a funcition. Type this in your browser: var a = { myFunction: function (msg) {console.log(msg);} }; a.myFunction("A test!!!"); a.myFunction = function (msg) {console.error("Error: " + msg);}; a.myFunction("A test!!!"); a.myFunction = "Hola"; console.log(a.myFunction);
3rd Sep 2020, 12:33 PM
Luis Malavé
Luis Malavé - avatar