mrt:webkit-notifications

v0.1.0Published 10 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

Meteor Webkit Notifications

Meteor Webkit Notifications provides reactive, webkit notifications for Meteor applications.

Installation

Meteor Webkit Notifications can be installed with Meteorite. From inside a Meteorite-managed app:

$ mrt add webkit-notifications

Note that version 0.1.0 works with Meteor 0.6.4 and later.

API

Setup

Request permissions from the browser:

1Template.exampleTemplate.events
2  "click .some-button": ()->
3    window.webkitNotifications.requestPermission()

Basics

Create a new notification in the future:

1Notifications.insert({
2  title: "Some title"
3  message: "Some message"
4  show_at: new Date()
5  userId: Meteor.userId()
6})

Detect a click?:

1# server
2Meteor.publish ()->
3  Notifications.find({
4    clicked: true
5    userId: @userId
6  })
7
8# client
9Notification.find(
10  clicked: true
11  userId: Meteor.userId()
12).observe
13  added: (notification)
14    Meteor._debug "click notification:", notification
15    # do some work and clean up
16    Notifications.remove(notification._id)

Security

No security is implemented, you'll need to configure your own policies.

Contributing

To run the tests, ensure that the webkit-notifications is checked out to a folder called webkit-notifications, and then simply run:

$ mrt test-packages webkit-notifications