WebAPI/LogAPI: Difference between revisions

no edit summary
No edit summary
No edit summary
 
(13 intermediate revisions by one other user not shown)
Line 1: Line 1:
== Proposer ==
José M. Cantera, Telefónica, jmcf@tid.es
== Use Cases ==
== Use Cases ==


To record the history of user activity with the device, particularly with communication services (Phone Calls, Messages, Social Networks, etc.)  
To record the history of user activity with the device, particularly with communication services (Phone Calls, Messages, Social Networks, etc.)
The Communications Log can have different views: Global or Per-Contact
 
Using the API the occurrence of incoming calls, missed calls, incoming messages, outgoing messages etc. is automatically recorded.


=== Consumers ===
=== Consumers ===
Line 9: Line 16:
=== Producers ===  
=== Producers ===  


* Dialer, SMS, e-mail, Facebook, Twitter, ...  
* Dialer, SMS, e-mail, Facebook, Twitter, ...


== WebIDL ==
== WebIDL ==


<pre>
<pre>
[NoInterfaceObject]
interface NavigatorLog {
    readonly attribute LogManager mozLog;
};
Navigator implements NavigatorLog;
[NoInterfaceObject]
[NoInterfaceObject]
interface LogManager : EventTarget  {
interface LogManager : EventTarget  {
Line 20: 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;
   attribute Function? onentryadded; // To listen for log changes
  };
  };


Line 28: 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;
};
};


dictionary LogFindFilter {
dictionary LogFindFilter {
   DOMString? contactId;
   DOMString? contactId;
   Date? from;
   Date? from;   // for defining a time interval
   Date? to;
   Date? to;       // for defining a time interval
   DOMString? service;
   DOMString? service; // to filter by service
   DOMString? type;
   DOMString? type;     // to filter by Log type
};
};


Line 46: Line 62:
   Date deadline;  // To clear all the entries older than the date passed as parameter
   Date deadline;  // To clear all the entries older than the date passed as parameter
   DOMString? contactId;  // To clear all the entries corresponding to a contact
   DOMString? contactId;  // To clear all the entries corresponding to a contact
   DOMString? tel;
   DOMString? tel;           // To clear all the entries corresponding to a tel number
};
};


Line 99: 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 108: Line 125:
}
}
</pre>
</pre>
[[Category:Web APIs]]
Confirmed users
1,340

edits