On 12/21/10, RobG <[email protected]> wrote:
>
>
> On Dec 21, 7:25 am, raysaun <[email protected]> wrote:
>> I'm fairly new to JS with no formal training, but I try my best to be
>> conscientious...
>>
>> I notice that in our code base lots of data gets shoved into the
>> browser's DOM. Is that a good idea? For example, a component might
>> perform an AJAX call, get a set of data from the server, and then
>> stick the result directly into the DOM (e.g.
>> company_namespace.component.content.result_1,
>> company_namespace.component.content.result_2, etc...) for later
>> access. It feels kind of dirty to me.
>
[...]
> However, I'm not sure that's what you're doing. Storing data in native
> objects and array is what they are designed for. You may create some
> "namespace" struture using an object, but you could also just create
> global variables with long names:
>
Sure, or you could pass the values around as parameter variables.
Suppose a user-defined xhr object fires `onsuccess` when the
underlying XHR is done. The callback for that event could call on
other functions.
xhr.onsuccess = function() {
infoPanel.showMessage(this.responseText);
};
Or those other objects could listen for success, e.g.
EventRegistry.addCallback(transporter, "onsuccess",
InfoPanel.processAjaxMessage);
> It's been covered in clj, seach there. Here's some threads:
>
Those threads seem more focused on the verbiage than on how and when
to organize and group related bits of functionality.
--
Garrett
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]