//News object
var newsItem = function(heading, type, time, details, ...)
{
this.heading = heading;
this.type = type;
this.time = time;
this.details = details;
....
};
// array of all newsItem objects
var newsItems = [news1, news2, news....];
I do two things with my above node.js server side code:
Question:
How do I make sure that when I am updating my newsItems object I dont use it to create html.
Since this is multi threaded, one thread serving a request and background thread updating the object from the news site. I need some kind of locking here in javascript. I am running into race condition here.
Thanks a lot.
If you are running Node.js as your server, you don't need any lock. It's a single-thread environment.
I'm not quite sure if I understand your question. First for server side operations you should use PHP. Second, if you update an variable you created even if it is an object html it is not automatically created if no events are linked.