totaljs / framework

Node.js framework
http://www.totaljs.com
Other
4.36k stars 450 forks source link

What is substitution for CONFIG method in total.js V4? #782

Closed LandyCuadra closed 3 years ago

LandyCuadra commented 3 years ago

Hi, I am trying to make a migration from total.js V3 to V4, we usually used in our definitions the method CONFIG (https://wiki.totaljs.com/jcomponent/03-globals#method-config-). So would like to know if theres another ways to do this in total.js V4

petersirka commented 3 years ago

@LandyCuadra the link is targeted to jComponent - client-side UI library.

In Total.js framework - use CONF.key instead of CONFIG() method. CONF is working in Total.js v3 too.

LandyCuadra commented 3 years ago

ooh thanks peter, just a last doubt, in the first link it leads to V4 conf and config exist there as function, so why it didn't worked?, are the ui component in a different library?

petersirka commented 3 years ago

CONF will work only in Total.js framework - in the view engine and once in the static files (.html, .js, .css) - because static files are compiled and cached. jComponent is a client-side UI library, and you don't need to use it with the Total.js framework (but we use the library in each Total.js product, and we offer more than 250 UI components for free).

UI components use config argument:

COMPONENT('mycomponent', function(self, config) {
    // @self {Component} component instance
    // @config {Object} with parsed configuration
});

Explanation:

LandyCuadra commented 3 years ago

Got it, thank you alot