ForgeComponents
en

Components

j-NativeNotifications

jComponent 20 · jcomponent@20 component Example loaded with jComponent 20
  • 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

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.

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>