angular-notification

WebJar for angular-notification

Лицензия

Лицензия

MIT
Категории

Категории

Github Инструменты разработки Контроль версий Angular Взаимодействие с пользователем Веб-фреймворки
Группа

Группа

org.webjars.bower
Идентификатор

Идентификатор

github-com-neoziro-angular-notification
Последняя версия

Последняя версия

1.1.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

angular-notification
WebJar for angular-notification
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/neoziro/angular-notification

Скачать github-com-neoziro-angular-notification

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.bower/github-com-neoziro-angular-notification/ -->
<dependency>
    <groupId>org.webjars.bower</groupId>
    <artifactId>github-com-neoziro-angular-notification</artifactId>
    <version>1.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bower/github-com-neoziro-angular-notification/
implementation 'org.webjars.bower:github-com-neoziro-angular-notification:1.1.1'
// https://jarcasting.com/artifacts/org.webjars.bower/github-com-neoziro-angular-notification/
implementation ("org.webjars.bower:github-com-neoziro-angular-notification:1.1.1")
'org.webjars.bower:github-com-neoziro-angular-notification:jar:1.1.1'
<dependency org="org.webjars.bower" name="github-com-neoziro-angular-notification" rev="1.1.1">
  <artifact name="github-com-neoziro-angular-notification" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bower', module='github-com-neoziro-angular-notification', version='1.1.1')
)
libraryDependencies += "org.webjars.bower" % "github-com-neoziro-angular-notification" % "1.1.1"
[org.webjars.bower/github-com-neoziro-angular-notification "1.1.1"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.webjars.bower : angular jar [1.4.0,1.5)

Модули Проекта

Данный проект не имеет модулей.

angular-notification

This plugin is no longer actively maintained, you can still use it but issues will not be resolved. If you want the npm name, you can contact me by email.

Build Status CDNJS Dependency Status devDependency Status

Notification service for Angular using native HTML5 API.

notification example

Install

Using bower

bower install angular-notification

Using npm

npm install angular-notification

Usage

angular.module('controllers.notification', ['notification'])
.controller('NotificationCtrl', function ($notification) {
  $notification('New message', {
    body: 'You have a new message.'
  });
})

$notification(title, options)

Create a new notification, the signature is the same as the Web Notification API.

Angular-notification provides some sugar to the default API, the permission is requested automatically. There is some options in addition to that already present in the official API:

  • "delay": Specify a delay (in ms) after the notification is automatically closed. Default null.
  • "focusWindowOnClick": Focus the window when the notification is clicked (works only on Chrome, Firefox prevent this for security issue). Default true.
$notification('title', {
  body: 'message',
  dir: 'auto',
  lang: 'en',
  tag: 'my-tag',
  icon: '/my-icon.jpg',
  delay: 1000, // in ms
  focusWindowOnClick: true // focus the window on click
})

$notificationProvider.setOptions(options)

Set default options.

$notificationProvider.setOptions({icon: '/my-icon.jpg'});

notification.close()

Close the notification.

var notification = $notification('hello');
notification.close();

notification.$on(name, listener)

Listen an event on the notification. Using this method, the listener is automatically wrapped in an $apply().

The signature is the same as the angular $scope.$on signature, it returns the deregistration function.

Avalaible examples are 'click', 'show', 'close' and 'error'.

var notification = $notification('hello');
var deregister = notification.$on('click', function () {
  console.log('User has clicked.');
});

// Stop listening the event.
deregister();

$notification.requestPermission()

Request explicitly the permission to display notification, more info in the official API.

$notification.requestPermission()
.then(function (permission) {
  console.log(permission); // default, granted, denied
});

$notification.getPermission()

Check the current permission to display notification. It returns a string of one of these values: default, granted, denied. more info in the official API.

var permission = $notification.getPermission(); // default, granted, denied

$notification.isSupported

A property of bool indicating whether the browser supports the desktop notification feature or not.

var isDesktopNotificationSupported = $notification.isSupported; // true, false

License

MIT

Версии библиотеки

Версия
1.1.1