MozContact.init()

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

JavaScript
contact.init(param);

Parameters

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

Example

JavaScript
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
The definition of 'Contacts Manager API' in that specification.
Working Draft First Working Draft (unstable)
vCard Format Specification IETF RFC RFC 6350

See also

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/mozcontact/init

API B2G DOM DOM Reference Firefox OS Method Reference Référence WebAPI