Cette traduction est incomplète. Aidez à traduire cet article depuis l'anglais.
Non standard
Cette fonctionnalité n'est ni standard, ni en voie de standardisation. Ne l'utilisez pas pour des sites accessibles sur le Web : elle ne fonctionnera pas pour tout utilisateur. Il peut également y avoir d'importantes incompatibilités entre les implémentations et son comportement peut être modifié dans le futur.
Cette API est disponible sur Firefox OS pour des applications privilégiées ou certifiées seulement.
Summary
The MozContact
interface is used to describe a single contact in the device's contact database.
The properties of the interface are similar to those defined in the vCard 4.0 specification, with the following exceptions:
- The vCard N attribute is split into 5 properties:
familyName
,givenName
,additionalName
,honorificPrefix
,honorificSuffix
- The vCard FN attribute is renamed
name
- The vCard GENDER attribute is split in 2 properties:
sex
,genderIdentity
Constructor
Starting from Firefox OS 1.3, the mozContact constructor accepts contact data as a parameter. This replaces the init
method that has been deprecated. See Using the Contact API for a code sample that is compatible with all Firefox OS versions.
// Firefox OS 1.0 to Firefox OS 1.2 var contact = new mozContact(); // Firefox OS 1.3+ var contact = new mozContact(data);
Properties
Note that most of the properties are arrays. While Firefox OS 1.0 to 1.2 is more forgiving, Firefox 1.3 has been made stricter concerning the types, and therefore it is very important to follow the type accurately to have a compatible application.
mozContact.id
Lecture seule- A unique id of the contact in the device's contact database.
mozContact.published
Lecture seule- A Date object giving the first time the contact was stored. This will eventually be converted to a
long long
timestamp, therefore to stay compatible over time, you should usevar published = +contact.published
to get and use a timestamp in your code. mozContact.updated
Lecture seule- A Date object giving the last time the contact was updated. This will eventually be converted to a
long long
timestamp, therefore to stay compatible over time, you should usevar updated = +contact.updated
to get and use a timestamp in your code. mozContact.name
- An array of string representing the different general names of the contact. This property can be used for searches since Firefox OS v1.3.
mozContact.honorificPrefix
- An array of string representing the different honorific prefixes of the contact.
mozContact.givenName
- An array of string representing the different given names of the contact. This property can be used for searches.
mozContact.additionalName
- An array of string representing any additional names of the contact.
mozContact.familyName
- An array of string representing the different family names of the contact. This property can be used for searches.
mozContact.honorificSuffix
- An array of string representing the different honorific suffixes of the contact.
mozContact.nickname
- An array of string representing the different nicknames of the contact.
mozContact.email
- An array of objects, each representing an e-mail with a few extra metadata. The email value can be used for searches.
mozContact.photo
- An array of
Blob
, which store the photos for the contact. mozContact.url
- An array of objects, each representing a URL with a few extra metadata.
mozContact.category
- An array of strings representing the different categories the contact is associated with. This property can be used for searches.
mozContact.adr
- An array of objects, each representing an address.
mozContact.tel
- An array of objects, each representing a phone number with a few extra metadata. The phone value can be used for searches, and has special matching criteria.
mozContact.org
- An array of strings representing the different organizations the contact is associated with.
mozContact.jobTitle
- An array of strings representing the different job titles of the contact.
mozContact.bday
- A Date object representing the date of birth of the contact. This will eventually be converted to a
long long
timestamp, therefore to stay compatible over time, you should usevar bday = +contact.bday
to get and use a timestamp in your code. mozContact.note
- An array of strings representing notes about the contact.
mozContact.impp
- An array of objects, each representing an Instant Messaging address with a few extra metadata.
mozContact.anniversary
- A Date object representing the date of marriage anniversary of the contact. This will eventually be converted to a
long long
timestamp, therefore to stay compatible over time, you should usevar anniversary = +contact.anniversary
to get and use a timestamp in your code. mozContact.sex
- A string representing the sex of the contact.
mozContact.genderIdentity
- A string representing the gender identity of the contact.
mozContact.key
- A array of string representing the public encryption key associated with the contact.
Methods
mozContact.init()
- Allows to initialize the contact object. This method has been deprecated in Firefox v1.3. See Using the Contact API for a code sample that is compatible with all Firefox OS versions.
Specifications
Specification | Status | Comment |
---|---|---|
Contacts Manager API La définition de 'Contacts Manager API' dans cette spécification. |
Obsolete | First Working Draft (unstable) |
vCard Format Specification | RFC | RFC6350 |
Browser compatibility
Nous convertissons les données de compatibilité dans un format JSON. Ce tableau de compatibilité utilise encore l'ancien format car nous n'avons pas encore converti les données qu'il contient. Vous pouvez nous aider en contribuant !
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
basic support | Pas de support | Pas de support | Pas de support | Pas de support | Pas de support |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
basic support | Pas de support | Pas de support | 18.0 (non standard) | Pas de support | Pas de support | Pas de support |
Gecko Note
As the specification is unstable, the Gecko implementation is completely non-standard.