app/assets/javascripts/condo/uploader.js in condo-1.0.0 vs app/assets/javascripts/condo/uploader.js in condo-1.0.1

- old
+ new

@@ -17,33 +17,29 @@ **/ (function (factory) { if (typeof define === 'function' && define.amd) { // AMD - define('condo_uploader', ['jquery'], factory); + define('condo-uploader', ['jquery', 'condo-broadcaster'], factory); } else { // Browser globals window.CondoUploader = factory(jQuery); } -}(function ($, undefined) { +}(function ($) { 'use strict'; - var uploads = angular.module('CondoUploader', []); + var uploads = angular.module('CondoUploader', ['CondoBroadcaster']), + residencies = {}; // // Implements the Condo API // - uploads.factory('Condo.Api', ['$http', '$rootScope', '$q', 'Condo.AmazonS3', 'Condo.RackspaceCloudFiles', 'Condo.GoogleCloudStorage', function($http, $rootScope, $q, AmazonS3Condo, RackspaceFilesCondo, GoogleStorageCondo) { + uploads.factory('Condo.Api', ['$http', '$rootScope', '$q', function($http, $rootScope, $q) { var token = $('meta[name="csrf-token"]').attr('content'), - residencies = { - AmazonS3: AmazonS3Condo, - RackspaceCloudFiles: RackspaceFilesCondo, - GoogleCloudStorage: GoogleStorageCondo - }, condoConnection = function(api_endpoint, params) { this.endpoint = api_endpoint; // The API mounting point this.params = params; // Custom API parameters @@ -287,10 +283,19 @@ }); } }); } }; - }]); + }]).factory('Condo.Registrar', function(){ + return { + // + // Simple dependency injection allows us to load only the providers we need + // + register: function(provider_name, iface) { + residencies[provider_name] = iface; + } + }; + }); // // Anonymous function return \ No newline at end of file