Jelajahi Sumber

add getEventSource method

Casey Holzer 9 tahun lalu
induk
melakukan
1f72cef027
1 mengubah file dengan 9 tambahan dan 1 penghapusan
  1. 9 1
      src/EventManager.js

+ 9 - 1
src/EventManager.js

@@ -17,6 +17,7 @@ function EventManager(options) { // assumed to be a calendar
 	// exports
 	t.isFetchNeeded = isFetchNeeded;
 	t.fetchEvents = fetchEvents;
+	t.getEventSource = getEventSource;
 	t.addEventSource = addEventSource;
 	t.removeEventSource = removeEventSource;
 	t.updateEvent = updateEvent;
@@ -227,7 +228,14 @@ function EventManager(options) { // assumed to be a calendar
 	
 	/* Sources
 	-----------------------------------------------------------------------------*/
-	
+
+
+	function getEventSource(id) {
+		return $.grep(sources, function(src) {
+			return src.id && src.id === id;
+		})[0];
+	}
+
 
 	function addEventSource(sourceInput) {
 		var source = buildEventSource(sourceInput);