Skip to content

Instantly share code, notes, and snippets.

@treasonx
Created August 6, 2013 17:59
Show Gist options
  • Save treasonx/6166904 to your computer and use it in GitHub Desktop.
Save treasonx/6166904 to your computer and use it in GitHub Desktop.
Seems like it would be great to refactor into a wire spec?
define(function () {
'use strict';
var LocationManager = require('modules/spxcontroller/LocationManager');
var WindowManager = require('modules/spxcontroller/WindowManager');
var SlinkAnchorService = require('modules/spxcontroller/SlinkAnchorService');
var PresentationService = require('modules/spxcontroller/PresentationService');
var g = require('utils/globalObject');
var utils = require('utils/utils');
function WindowController(evtBus, dataStore, analytics) {
this.slinkService = new SlinkAnchorService(g);
this.windowManager = new WindowManager(evtBus, dataStore);
this.service = new PresentationService(dataStore, analytics);
this.locationManager = new LocationManager(evtBus,
this.service,
this.windowManager,
this.slinkService, {
offSiteHandler: utils.getOffsiteHandler(g, analytics, dataStore)
});
}
WindowController.prototype = {
start: function() {
this.locationManager.start();
}
};
return WindowController;
});
@treasonx
Copy link
Author

treasonx commented Aug 6, 2013

Definition for utils/globalObject:

define(function() {
  return window;
});

In Thirdparty JavaScript its helpful to be able to swap out window objects without the framework making any assumptions. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment