-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2) Implemented Pub/Sub Model 3) Implemented event list view in react Signed-off-by: Neha Gupta <[email protected]>
- Loading branch information
Showing
10 changed files
with
303 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const PubSubService = { | ||
topics: {}, | ||
subscribe: function(topic, listener) { | ||
var that = this; | ||
|
||
// Create the topic's object if not yet created | ||
if (!that.topics.hasOwnProperty.call(that.topics, topic)) { | ||
that.topics[topic] = []; | ||
} | ||
|
||
// Add the listener to queue | ||
var index = that.topics[topic].push(listener) - 1; | ||
|
||
// Provide handle back for removal of topic | ||
return { | ||
remove: function() { | ||
delete that.topics[topic][index]; | ||
} | ||
}; | ||
}, | ||
publish: function(topic, info) { | ||
var that = this; | ||
|
||
// If the topic doesn't exist, or there's no listeners in queue, just leave | ||
if (!that.topics.hasOwnProperty.call(that.topics, topic)) return; | ||
|
||
// Cycle through topics queue, fire! | ||
that.topics[topic].forEach(function(item) { | ||
item(info != undefined ? info : {}); | ||
}); | ||
} | ||
}; | ||
|
||
|
||
angular | ||
.module("TendrlModule") | ||
.service("pubSubService", pubSubService); | ||
|
||
/*@ngInject*/ | ||
function pubSubService() { | ||
return PubSubService; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import React, { Component } from "react"; | ||
import moment from "moment"; | ||
import DatePicker from 'react-datepicker'; | ||
require("ngreact"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.