Sha256: d8721748566e7c57a3828f779c4879ef54d44234efdeadecab457342da621f97

Contents?: true

Size: 1.46 KB

Versions: 3

Compression:

Stored size: 1.46 KB

Contents

/**
*	CoTag Condo Amazon S3 Strategy
*	Direct to cloud resumable uploads for Google Cloud Storage
*	
*   Copyright (c) 2012 CoTag Media.
*	
*	@author 	Stephen von Takach <steve@cotag.me>
* 	@copyright  2012 cotag.me
* 
* 	
* 	References:
* 		* https://github.com/umdjs/umd
* 		* https://github.com/addyosmani/jquery-plugin-patterns
*		* 
*
**/

(function (factory) {
	if (typeof define === 'function' && define.amd) {
		// AMD
		define('condo-broadcaster', factory);
	} else {
		// Browser globals
		factory();
	}
}(function (undefined) {
	'use strict';
	
	
	//
	// 
	//
	
	
	angular.module('CondoBroadcaster', []).factory('Condo.Broadcast', ['$rootScope', function($rootScope) {
		// eventBroadcaster is the object created by the factory method.
		var eventBroadcaster = {};
		
		// The message is a string or object to carry data with the event.
		eventBroadcaster.message = {};
		
		// The event name is a string used to define event types.
		eventBroadcaster.eventName = '';
		
		// This method is called from within a controller to define an event and attach data to the eventBroadcaster object.
		eventBroadcaster.broadcast = function(evName, msg) {
			this.message = msg;
			this.eventName = evName;
			this.broadcastItem();
		};
		
		// This method broadcasts an event with the specified name.
		eventBroadcaster.broadcastItem = function() {
			$rootScope.$broadcast(this.eventName);
		};

		return eventBroadcaster;
	}]);
	
}));

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
condo-1.0.4 app/assets/javascripts/condo/broadcaster.js
condo-1.0.3 app/assets/javascripts/condo/broadcaster.js
condo-1.0.2 app/assets/javascripts/condo/broadcaster.js