Where should I store settings for my javascript program?

-- Full disclosure -- this is homework, and this is my capstone project. --

I've written my first big Obj-Oriented Javascript charting application (bar charts, gantt charts, etc) and I'd like to give users the option to customize output -- things like font size, charting colors, etc.

Right now, I'm passing in a config file that contains global variables which are either A) hard-coded, or B) pulling params from the URL. (To be clear, I think its a "config" file -- its just a *.js file with a bunch of globals in in).

My question is this -- is there a better technique for doing this than loading a config file into the global space? What is the "best practice" for this type of thing? Should I have a "settings" object? Or store the settings in an xml file?

8
задан Daniel Szabo 30 January 2015 в 17:04
поделиться