Commit 1a13c108 authored by Lidan Hifi's avatar Lidan Hifi

add mocha for testing, eslint

parent 40c01540
{
"parser": "babel-eslint",
"env": {
"node": true,
"mocha": true,
"es6": true
},
"extends": "eslint:recommended",
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"no-trailing-spaces": "error",
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
],
"camelcase": [
"error",
{"properties": "always"}
],
"eqeqeq": [
"error",
"smart"
]
}
}
# React Native Notifications
Handle push notifications for your app, including permission handling and icon badge number.
In progress
......@@ -2,14 +2,14 @@
* @providesModule RNNotifications
* @flow
*/
'use strict';
import { NativeModules, DeviceEventEmitter } from 'react-native';
import Map from 'core-js/library/es6/map';
var NativeRNNotifications = NativeModules.RNNotifications;
"use strict";
import { NativeModules, DeviceEventEmitter } from "react-native";
import Map from "core-js/library/es6/map";
var NativeRNNotifications = NativeModules.RNNotifications; // eslint-disable-line no-unused-vars
var DEVICE_NOTIFICATION_RECEIVED_FOREGROUND_EVENT = 'notificationReceivedForeground';
var DEVICE_NOTIFICATION_RECEIVED_BACKGROUND_EVENT = 'notificationReceivedBackground';
var DEVICE_NOTIFICATION_OPENED_EVENT = 'notificationOpened';
var DEVICE_NOTIFICATION_RECEIVED_FOREGROUND_EVENT = "notificationReceivedForeground";
var DEVICE_NOTIFICATION_RECEIVED_BACKGROUND_EVENT = "notificationReceivedBackground";
var DEVICE_NOTIFICATION_OPENED_EVENT = "notificationOpened";
var _notificationHandlers = new Map();
......@@ -28,14 +28,14 @@ class NotificationsIOS {
if (type === DEVICE_NOTIFICATION_RECEIVED_FOREGROUND_EVENT ||
type === DEVICE_NOTIFICATION_RECEIVED_BACKGROUND_EVENT ||
type === DEVICE_NOTIFICATION_OPENED_EVENT) {
var listener = DeviceEventEmitter.addListener(
type,
(notification) => {
handler(notification);
}
);
var listener = DeviceEventEmitter.addListener(
type,
(notification) => {
handler(notification);
}
);
_notificationHandlers.set(handler, listener);
_notificationHandlers.set(handler, listener);
}
}
......@@ -47,13 +47,13 @@ class NotificationsIOS {
if (type === DEVICE_NOTIFICATION_RECEIVED_FOREGROUND_EVENT ||
type === DEVICE_NOTIFICATION_RECEIVED_BACKGROUND_EVENT ||
type === DEVICE_NOTIFICATION_OPENED_EVENT) {
var listener = _notificationHandlers.get(handler);
if (!listener) {
return;
}
var listener = _notificationHandlers.get(handler);
if (!listener) {
return;
}
listener.remove();
_notificationHandlers.delete(handler);
listener.remove();
_notificationHandlers.delete(handler);
}
}
}
......
{
"name": "react-native-notifications",
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"repository": {
"type": "git",
"url": "https://github.com/wix/react-native-notifications.git"
},
"version": "0.0.5",
"description": "Advanced Push Notifications (Silent, interactive notifications) for iOS & Android",
"author": "Lidan Hifi <lidan.hifi@gmail.com>",
"license": "MIT",
"keywords": [
"react-component",
"react-native",
"react native",
"ios",
"push-notifications"
"push-notifications",
"notifications",
"notification",
"react native notifications"
],
"nativePackage": true,
"dependencies": {
"core-js": "^1.0.0"
},
"peerDependencies": {
"react-native": ">=0.19.0"
},
"devDependencies": {
"babel-eslint": "^6.0.2",
"chai": "^3.5.0",
"chokidar-cli": "^1.2.0",
"eslint": "^2.7.0",
"mocha": "^2.4.5"
},
"scripts": {
"pretest": "./node_modules/.bin/eslint *.js test",
"test": "./node_modules/.bin/mocha --reporter spec \"test/*.spec.js\"",
"start": "npm run test --silent; ./node_modules/.bin/chokidar \"test/*.js\" \"*.js\" -c 'npm run test --silent' --silent"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"repository": {
"type": "git",
"url": "https://github.com/wix/react-native-notifications.git"
},
"homepage": "https://github.com/wix/react-native-notifications",
"bugs": {
"url": "https://github.com/wix/react-native-notifications/issues"
},
"dependencies": {
"core-js": "^1.0.0"
},
"author": "Lidan Hifi <lidan.hifi@gmail.com>",
"main": "index.ios.js",
"license": "MIT"
"main": "index.ios.js"
}
var expect = require("chai").expect;
describe("NotificationsIOS", function () {
it("should pass", function () {
expect(true).to.be.true;
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment