On Wednesday, May 27, 2015 at 2:37:26 AM UTC-7, Jan Honza Odvarko wrote:
>
>
>
> On Tuesday, May 26, 2015 at 7:08:32 PM UTC+2, Ahmad Nassri wrote:
>>
>>
>> 2) Expose helper event:
>>>
>>> "HARPageLoaded": sent when the page finishes loading. This is different 
>>> from the existing 'DOMContentLoaded' and 'load' events. This new event is 
>>> sent when there are no pending HTTP requests and no new HTTP requests has 
>>> started for given period of time (e.g. 1000 ms).
>>>
>>> I believe that the trigger method and the event should be enough for 
>>> integration with any automated system (e.g. based on Selenium). The rest is 
>>> upto the automated system - the driver.
>>>
>>> What do you think?
>>>
>>> Can we simplify the feature yet?
>>> Do you need more to implement automated HAR export from the browser?
>>>
>>
>> I don't see the value gained here by adding another DOM level event? 
>> "DOMContentLoaded" is the correct event to listen to, then ask for the HAR 
>> export.
>>
>> in other words: I'm listening on events related to the DOM, and any 
>> changes related to it "HARPageLoaded" does not translate to a "DOM" event 
>> as far as I can tell, it's a background process that's creating the HAR 
>> object, not affecting the DOM object itself.
>>
>> another example is adding an image element and listening to "load" event 
>> then triggering HAR export.
>> similarly, any DOM-level event can be used to trigger export, current or 
>> future ones ("load", "domready", etc ... depending on implementation / 
>> browser)
>>
> OK, sounds good to me, that would make the feature-implementation even 
> easier.
>  
>
>>
>> if creating the HAR object does in deed require an event-like behaviour 
>> (its happening in a different thread / background process / etc ...) then 
>> there can still be an event such as "HARReady", but on the HAR object, not 
>> the DOM. example:
>>
>> document.addEventListener("DOMContentLoaded", function gimmeHAR (e) {
>>   // initiate somehow
>>   var har = window.HAR.export()
>>   // or
>>   var har = new HAR.triggerExport()
>>   // etc ...
>>
>>   har.addEventListener("ready", function nomnom (Obj) {
>>     // Obj = HAR goodness
>>   })
>> })
>>
>> Exporting HAR can indeed happen in different process (even on different 
> device) in case monitoring e.g. mobile device, but I was thinking about 
> using promises that informs the caller about HAR data being ready, so 
> instead of firing ready a promise would be resolved instead. Something like 
> as follows:
>
> HAR.triggerExport(options).then(function(result) {
>   var har = result.data;
>   console.log(har);
> });
>
> Would that work for you?
>
>
yep, that works perfectly fine (I prefer promises when possible) my example 
was simply following the "eventListener" discussion from earlier ...

-- 
You received this message because you are subscribed to the Google Groups 
"Firebug" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/firebug.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/firebug/7f43aa0b-42d7-4154-adf4-38ee90432206%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to