No description or website provided.
JavaScript
Latest commit ff034ae Mar 31, 2016 @BrandonSmith BrandonSmith Bumping to 2.0.0
Updating dependencies is a large enough change to justify major bump
Permalink
Failed to load latest commit information.
dist
docs
examples/hello-world
scripts
src
test
.babelrc
.editorconfig
.eslintrc
.gitattributes
.gitignore
.npmignore
LICENSE
README.md
package.json

README.md

Cycle Notification Driver

A Cycle.js Driver for showing and responding to HTML5 Notifications.

npm install @cycle/notification

Usage

Basics:

import Cycle from '@cycle/core';
import { makeNotificationDriver } from '@cycle/notification'

function main({notification}) {
  // ...
}

const drivers = {
  notification: makeNotificationDriver()
}

Cycle.run(main, drivers)

Simple and normal use case:

function main({notification}) {

    let notifications$ = Rx.Observable
            .interval(10000)
            .startWith(-1)
            .map( (value) => ({
                title: 'Test Notification',
                body: `Interval ${value}`,
                tag: 'test-notification',
                icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAIAAAACDbGyAAAAEUlEQVQIW2Pg3uSLjBgo5AMACSoZ+1zqJ8AAAAAASUVORK5CYII='
            }) )
            .take(10),
        show$ = notification.get('show'),
        click$ = notification.get('click'),
        error$ = notification.get('error'),
        close$ = notification.get('close'),
        all$ = Rx.Observable.merge(show$, click$, error$, close$)

    all$.do(args => console.log(args)).subscribe()

    return {
        notification: notifications$
    }
}