WebAPI/LogAPI: Difference between revisions

no edit summary
No edit summary
 
(8 intermediate revisions by one other user not shown)
Line 21: Line 21:


<pre>
<pre>
[NoInterfaceObject]
[NoInterfaceObject]
interface NavigatorLog {
interface NavigatorLog {
Line 35: Line 34:
     DOMRequest clear(LogClearOptions coptions);  // To clear the log for maintenance purposes
     DOMRequest clear(LogClearOptions coptions);  // To clear the log for maintenance purposes
     // Entries are always returned ordered by timestamp (desc)
     // Entries are always returned ordered by timestamp (desc)
     DOMRequest find(optional LogFindOptions options,optional IteratorOptions iopts);
     DOMRequest find(optional LogFindFilter filter,optional IteratorOptions iopts);
          
          
   attribute Function? onentryadded;  // To listen for log changes
   attribute Function? onentryadded;  // To listen for log changes
Line 43: Line 42:
[NoInterfaceObject]
[NoInterfaceObject]
interface DOMIterator {
interface DOMIterator {
   DOMRequest next(optional unsigned short n);  // returns the next window
   DOMRequest next();  // request to refresh the window of objects with the next
   attribute boolean hasMore;
   DOMRequest prev();  // request to refresh the window of objects with the prev
   attribute unsigned long position; // points always to the element that will be the first returned by the window
  DOMRequest skipTo(unsigned long chunk);
  readonly attribute boolean hasMore;
   readonly attribute unsigned long count;  // total number of objects
   readonly attribute unsigned long count;  // total number of objects
   readonly attribute any[] values;  // Contains the current window of objects
   readonly attribute any[]? values;  // Contains the current window of objects
  readonly attribute chunkSize;
};
};


Line 114: Line 115:
   var iterator = e.target.result;
   var iterator = e.target.result;
    
    
   for(var c = 0; c < iterator.values.length; c++) {
  var logEntries = iterator.values;
   for(var c = 0; c < logEntries.length; c++) {
     window.console.log('LogEntry: ', logEntries[c].type,logEntries[c].timestamp);
     window.console.log('LogEntry: ', logEntries[c].type,logEntries[c].timestamp);
   }
   }
Line 123: Line 125:
}
}
</pre>
</pre>
[[Category:Web APIs]]
Confirmed users
1,340

edits