mozContact.init

« DOM Reference

Non-standard
This feature is not on a current W3C standards track, but it is supported on the Firefox OS platform. Although implementations may change in the future and it is not supported widely across browsers, it is suitable for use in code dedicated to Firefox OS apps.

This API is available on Firefox OS for privileged or certified applications only.

Summary

The init method is used to initialize the mozContact object using a configuration object.

Syntax

contact.init(param);

Parameters

param
A configuration object which properties are one or more of the properties allow for mozContact. Note that idpublished and update will be ignored as they are automatically generated and overridden when the contact is stored.

Example

var contact = new mozContact();
contact.init({name: "John Doe", givenName: "John", familyName: "Doe"});

var request = navigator.mozContacts.save(contact);

request.onsuccess = function() {
   alert("Success saving contact. New contact ID: " + contact.id);
};

request.onerror = function() {
   alert("Error saving contact.");
};

 

 

Specifications

Specification Status Comment
Contacts Manager API Working Draft First Working Draft (unstable)
vCard Format Specification RFC RFC6350

See also

Document Tags and Contributors

Contributors to this page: kscarfone, PostaL
Last updated by: kscarfone,