Skip to content

Commit 8923885

Browse files
committed
Merge pull request #1 from faizulhaque/master
initial commit -- complete
2 parents 4f0c496 + b266dbb commit 8923885

File tree

10 files changed

+988
-0
lines changed

10 files changed

+988
-0
lines changed

.jshintrc

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"boss": true,
3+
"curly": true,
4+
"devel": false,
5+
"eqeqeq": true,
6+
"expr": true,
7+
"immed": true,
8+
"indent": 4,
9+
"latedef": true,
10+
"newcap": true,
11+
"noarg": true,
12+
"noempty": true,
13+
"node": true,
14+
"quotmark": "double",
15+
"sub": true,
16+
"trailing": true,
17+
"undef": true,
18+
"unused": true,
19+
"eqnull": true,
20+
"globals": {
21+
"_": true,
22+
"$": true,
23+
"after": true,
24+
"afterEach": true,
25+
"angular": true,
26+
"before": true,
27+
"beforeEach": true,
28+
"chance": true,
29+
"describe": true,
30+
"document": true,
31+
"expect": true,
32+
"it": true,
33+
"localStorage": true,
34+
"moment": true,
35+
"qs": true,
36+
"request": true,
37+
"URI": true,
38+
"window": true,
39+
"Zombie": true
40+
}
41+
}

Gruntfile.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
2+
module.exports = function(grunt) {
3+
4+
// Load all grunt tasks automatically
5+
require("load-grunt-tasks")(grunt);
6+
7+
// Time how long tasks take
8+
require("time-grunt")(grunt);
9+
10+
grunt.config.init({
11+
jshint: {
12+
options: {
13+
jshintrc: ".jshintrc",
14+
reporter: require("jshint-stylish")
15+
},
16+
all: {
17+
src: [
18+
"Gruntfile.js",
19+
"controllers/*.js",
20+
"components/*.js",
21+
"lib/*.js",
22+
"tests/*.js"
23+
]
24+
}
25+
},
26+
27+
mochaTest: {
28+
options: {
29+
globals: ["should"],
30+
timeout: 10000,
31+
ui: "bdd",
32+
reporter: "dot"
33+
},
34+
all: {
35+
src: ["tests/index.js"]
36+
}
37+
},
38+
39+
watch: {
40+
files: [
41+
"Gruntfile.js",
42+
"controllers/*.js",
43+
"lib/**/*.js",
44+
"middleware/*.js",
45+
"tests/**/*.js"
46+
47+
],
48+
default: {
49+
files: "<%= watch.files %>",
50+
tasks: ["newer:jshint", "mochaTest"]
51+
}
52+
53+
}
54+
});
55+
56+
grunt.registerTask("test", ["jshint", "mochaTest"]);
57+
grunt.registerTask("default", ["watch:default"]);
58+
};
59+

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#circulate
2+
3+
Notification Library
4+
5+
##Supported Clients
6+
7+
1. iOS
8+
9+
##Comming Soon
10+
11+
2. Android
12+
3. Windows

index.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
var Ios = require("./lib/ios");
2+
3+
function Notification() {
4+
//initilize the client var
5+
this.clients = {};
6+
}
7+
8+
Notification.prototype.setupIOSClient = function setupIOSClient(
9+
dev_key_path, dev_cert_path, prod_key_path, prod_cert_path) {
10+
var self = this;
11+
self.clients.ios = new Ios(dev_key_path, dev_cert_path, prod_key_path, prod_cert_path);
12+
self.clients.ios.onTransmitted = self.onTransmitted;
13+
self.clients.ios.onTransmissionError = self.onTransmissionError;
14+
};
15+
16+
Notification.prototype.send = function send(devices, data, is_silent) {
17+
var self = this;
18+
if(Object.getOwnPropertyNames(self.clients).length === 0){
19+
throw new Error("clients list is empty.");
20+
}
21+
for(var k in self.clients) {
22+
self.clients[k].send(devices, data, is_silent);
23+
}
24+
};
25+
26+
/**
27+
*
28+
* Generic event for caller to override
29+
* when transmission is successfully on any client, this event will be fired.
30+
* client is attached so that caller will know transmission is successfully from which client
31+
*
32+
* @author Faiz <[email protected]>
33+
* @param client
34+
* @param notificationObj
35+
* @param recipient
36+
* @version 0.1
37+
*/
38+
Notification.prototype.onTransmitted = function onTransmitted(client, notificationObj, recipient) {
39+
};
40+
41+
/**
42+
*
43+
* Generic event for caller to override
44+
* when transmission error on any client, this event will be fired.
45+
* client is attached so that caller will know transmission is unsuccessfully from which client
46+
*
47+
* @author Faiz <[email protected]>
48+
* @param client
49+
* @param notificationObj
50+
* @param recipient
51+
* @version 0.1
52+
*/
53+
Notification.prototype.onTransmissionError = function onTransmissionError(client, errorCode, notificationObj, recipient) {
54+
};
55+
56+
module.exports = Notification;

0 commit comments

Comments
 (0)