# j-NativeNotifications

> j-NativeNotifications: easy usage; singleton

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: en
Content-SHA256: 7b27cd79d303b973bf28304c74fa69d4466cbbfbb6f6889167389edc36456dad
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

- singleton


__Configuration__

- `timeout {Number}` needs to contain a timeout (milliseconds) for the expiration of notification (default: `8000`)
- `icon {String}` (optional) an icon (default `/icon.png`)

__Methods__
- `component.append(title, message, [callback], [icon])` for creating a new notification

__Usage__

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

Use it with `<ui-component name="nativenotifications">`. When the component is not loaded yet, jComponent downloads it on first use from the address in `DEF.fallback` (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.

```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>
```
