Oops yes I've seen this done before. Will update.

On Wed, Jul 24, 2013 at 3:59 PM, Bennet Huber <notifications@github.com>wrote:

> In python/ecep/portal/static/js/cel/favorites.js:
>
> > +define(['jquery', 'cel-cookie', 'jquery-cookie'], function($, celcookie) {
> > +
> > +    'use strict';
> > +
> > +    return {
> > +
> > +        /*
> > +         * Store a reference here so we don't have to pass it around
> > +         */
> > +        cookie: celcookie,
> > +
> > +        /*
> > +         * Given a location id, adds the location id to the correct cookie
> > +         */
> > +        addIdToCookie: function(id) {
> > +            var cookie = this.cookie,
>
> Using 'this' here is dangerous because you don't know what the caller is
> actually going to bind this function to. The typical workaround is to avoid
> using the this keyword unless you really want it's context-sensitive
> binding (DOM event handlers for example). For module files, the usual way
> is to replace the "return" above with "var that = ", replace this -> that
> where necessary, and then add a "return that;" at the end of the module.
> Most of the uses of this in this file should be replaced, except those in
> the click handlers, etc.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/smartchicago/chicago-early-learning/pull/216/files#r5382298>
> .
>