CNContactPickerContactsEvent
CNContactPickerContactsEvent represents the user checking several contacts in the system contact picker and tapping Done.
The contactsselect event of CNContactPickerViewController is this class, and contacts is the contacts checked.
It belongs to the @nacrejs/contacts package; for installation, see CNContactPickerViewController.
Inheritance: Event → CNContactPickerContactsEvent
Constructor
CNContactPickerContactsEvent()
Creates a CNContactPickerContactsEvent. The runtime creates one itself when it fires the events below; app code can use it to build an event object and fire it with dispatchEvent() to try out a listener.
Instance properties
Also inherits the properties of Event; the most commonly used are type and target. The properties below are read-only; assigning to them throws TypeError.
| Property | Description |
|---|---|
contacts read-only | The contacts the user checked |
These properties live on the prototype, not on the event object itself: Object.keys(event) and { ...event } don't include them, so read them one by one. See Events with fields.
Events that use this class
| Object | Events |
|---|---|
CNContactPickerViewController | contactsselect |
It can't be canceled: cancelable is false, and preventDefault() has no effect. After it is fired, the system closes the picker.
Examples
const page = new UIViewController();
const picker = new CNContactPickerViewController();
picker.addEventListener('contactsselect', (e) => {
console.log(e instanceof CNContactPickerContactsEvent);
});
page.presentViewController(picker, { animated: true });Effect: after the user makes a choice in the picker, prints true. Not verified in the simulator.
Corresponding iOS API
| ObjC | JS |
|---|---|
contactPicker:didSelectContacts: | The contactsselect event |
The contacts parameter | event.contacts |
See also
CNContactPickerViewController: the object that fires this eventcontactsselect: when it is fired