Hello all,
I’m quite new at js and I’m facing an issue that I hope someone can help me:
I have below object created in user.jsw module :
export const status =
{
APROVED:‘APROVED’,
PENDING:‘PENDING’,
BLOCKED:‘BLOCKED’,
ACTIVE :‘ACTIVE’,
INACTIVE:‘INACTIVE’
};
and I wan’t to use this object or a copy of it in other modules or page.
how can I import it ?
I’ve try to use " import status from ‘backend/user’;" I get undefined value.
Thank you
Thank you! I know how to import functions but the case here is importing an object, I cloud wrap this object into a function but I want to know if I can do it without function. Use this object like a global variable.
@vitor_barros21 See the Web Modules docs that state: “Unlike regular modules that allow you to export functions, objects, and other items, you can only export functions from web modules.”.
@yisrael-wix hum lack of attention from my side! So I can use above code in a .js instead a .jsw module?
@vitor_barros21 You can’t really treat an object as a “global” since it really isn’t. The backend is one entity and the frontend is a separate entity altogether.
Corvid handles web modules in a special manner to make it easier for the developer to handle them. They just “appear” to be imported.
@yisrael-wix ok, sorry to take your time but I came from .net (c#) world that is a bit diferent from this :). Thank you for your availability!!