Skip to content

initial commit -- complete #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 31, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"boss": true,
"curly": true,
"devel": false,
"eqeqeq": true,
"expr": true,
"immed": true,
"indent": 4,
"latedef": true,
"newcap": true,
"noarg": true,
"noempty": true,
"node": true,
"quotmark": "double",
"sub": true,
"trailing": true,
"undef": true,
"unused": true,
"eqnull": true,
"globals": {
"_": true,
"$": true,
"after": true,
"afterEach": true,
"angular": true,
"before": true,
"beforeEach": true,
"chance": true,
"describe": true,
"document": true,
"expect": true,
"it": true,
"localStorage": true,
"moment": true,
"qs": true,
"request": true,
"URI": true,
"window": true,
"Zombie": true
}
}
59 changes: 59 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@

module.exports = function(grunt) {

// Load all grunt tasks automatically
require("load-grunt-tasks")(grunt);

// Time how long tasks take
require("time-grunt")(grunt);

grunt.config.init({
jshint: {
options: {
jshintrc: ".jshintrc",
reporter: require("jshint-stylish")
},
all: {
src: [
"Gruntfile.js",
"controllers/*.js",
"components/*.js",
"lib/*.js",
"tests/*.js"
]
}
},

mochaTest: {
options: {
globals: ["should"],
timeout: 10000,
ui: "bdd",
reporter: "dot"
},
all: {
src: ["tests/index.js"]
}
},

watch: {
files: [
"Gruntfile.js",
"controllers/*.js",
"lib/**/*.js",
"middleware/*.js",
"tests/**/*.js"

],
default: {
files: "<%= watch.files %>",
tasks: ["newer:jshint", "mochaTest"]
}

}
});

grunt.registerTask("test", ["jshint", "mochaTest"]);
grunt.registerTask("default", ["watch:default"]);
};

12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#circulate

Notification Library

##Supported Clients

1. iOS

##Comming Soon

2. Android
3. Windows
56 changes: 56 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
var Ios = require("./lib/ios");

function Notification() {
//initilize the client var
this.clients = {};
}

Notification.prototype.setupIOSClient = function setupIOSClient(
dev_key_path, dev_cert_path, prod_key_path, prod_cert_path) {
var self = this;
self.clients.ios = new Ios(dev_key_path, dev_cert_path, prod_key_path, prod_cert_path);
self.clients.ios.onTransmitted = self.onTransmitted;
self.clients.ios.onTransmissionError = self.onTransmissionError;
};

Notification.prototype.send = function send(devices, data, is_silent) {
var self = this;
if(Object.getOwnPropertyNames(self.clients).length === 0){
throw new Error("clients list is empty.");
}
for(var k in self.clients) {
self.clients[k].send(devices, data, is_silent);
}
};

/**
*
* Generic event for caller to override
* when transmission is successfully on any client, this event will be fired.
* client is attached so that caller will know transmission is successfully from which client
*
* @author Faiz <[email protected]>
* @param client
* @param notificationObj
* @param recipient
* @version 0.1
*/
Notification.prototype.onTransmitted = function onTransmitted(client, notificationObj, recipient) {
};

/**
*
* Generic event for caller to override
* when transmission error on any client, this event will be fired.
* client is attached so that caller will know transmission is unsuccessfully from which client
*
* @author Faiz <[email protected]>
* @param client
* @param notificationObj
* @param recipient
* @version 0.1
*/
Notification.prototype.onTransmissionError = function onTransmissionError(client, errorCode, notificationObj, recipient) {
};

module.exports = Notification;
Loading