# j-NativeNotifications

> j-NativeNotifications : utilisation facile ; singleton

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: fr
Content-SHA256: 40290867c201ee6548685830b84f9d54e666f8820aaea2e7fb25ccf980f9e197
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

- singleton


__Configuration__

- `timeout {Number}` doit contenir un délai d'attente (millisecondes) pour l'expiration de la notification (par défaut : `8000`)
- `icon {String}` (facultatif) une icône (par défaut `/icon.png`)

__Méthodes__
- `component.append(title, message, [callback], [icon])` pour créer une nouvelle notification

__Utilisation__

```javascript
SETTER('nativenotifications/show', 'TITLE', 'MESSAGE', function() {
    // optional, click
}, '/img/warning-optional.png');
```

Utilisez-le avec `<ui-component name="nativenotifications">`. Lorsque le composant n'est pas encore chargé, jComponent le télécharge lors de la première utilisation depuis l'adresse dans `DEF.fallback` (le CDN Componentator par défaut). Auteur : Peter Širka. Source : le référentiel de composants Componentator, licence MIT.

```html example.html
<ui-component name="nativenotifications" path="allowNotifications"></ui-component>

<script>
	var allowNotifications = true;

	setTimeout(function() {
		SETTER('nativenotifications/append', 'Hello!', 'jComponent is a great solution for everyone.', null, 'https://messenger.totaljs.com/icon.png');
	}, 3000);
</script>
```
