Skip to content

Commit

Permalink
Make external api to a factory function
Browse files Browse the repository at this point in the history
  • Loading branch information
LFDM committed May 6, 2014
1 parent d247418 commit 04d3ee4
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions app/js/other/arethusa_external_api.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

window.ArethusaExternalApi = (function () {
window.ArethusaExternalApi = function () {
var obj = {};

obj.isArethusaLoaded = function() {
Expand All @@ -16,17 +16,16 @@ window.ArethusaExternalApi = (function () {
// if it's not, we provide a mock object that just does nothing.
if (obj.isArethusaLoaded) {
angular.element(document.body).ready(function() {
obj.state = angular.element(document.body).injector().get('state');
console.log(obj.state);
obj.injector = angular.element(document.body).injector();
obj.state = obj.injector.get('state');
obj.fireEvent = function(token, category, oldVal, newVal) {
obj.state.fireEvent(token, category, oldVal, newVal);
};
});

//obj.state = injector().get('state');
//obj.fireEvent = function(token, category, oldVal, newVal) {
//obj.state.fireEvent(token, category, oldVal, newVal);
//};
} else {
// tbd - BlackHole object
}

return obj;
}());
};

0 comments on commit 04d3ee4

Please sign in to comment.