Amateur question about require()


#1

Hi all,

I hope I’m not too daft for asking this question but I’d really like an answer so I can stop wondering…

I use {N} dialogs a lot and require them the way the documentation says: var dialogs = require("ui/dialogs");

I usually do this in every page where I use dialogs. But quick question: wouldn’t it make sense to require it on my app.js file and that way it’s available throughout the app? Would it be? Please advise. Or do I need to require files each time I want to use them throughout the app?

Nick


#2

There is a global alert function you can use without importing anything. Otherwise you must require the library when needed.