(function() {
  angular.module('notely.login')
    .service('CurrentUser', CurrentUser);

  CurrentUser['$inject'] = ['$window']
  function CurrentUser($window) {
    var currentUser = JSON.parse($window.localStorage.getItem('currentUser'));

    this.set = function(user) {
      currentUser = user;
      $window.localStorage.setItem('currentUser', JSON.stringify(currentUser));
    }

    this.get = function() {
      return currentUser || {};
    }

    this.clear = function() {
      currentUser = undefined;
      $window.localStorage.removeItem('currentUser');
    }
  }
})();

angular.module('notely.login')
  .service('CurrentUser', ['$window', ($window) => {

  class CurrentUser {
    constructor() {
      this.currentUser = JSON.parse($window.localStorage.getItem('currentUser'));
    }

    set(user) {
      this.currentUser = user;
      $window.localStorage.setItem('currentUser', JSON.stringify(this.currentUser));
    }

    get() {
      return this.currentUser || {};
    }

    clear() {
      this.currentUser = undefined;
      $window.localStorage.removeItem('currentUser');
    }
  }
  return new CurrentUser();

}]);

Make CurrentUser service use class syntax with inherited dependencies.
Make CurrentUser service use class syntax with inherited dependencies.

This is one way to possibly alleviate concerns with having to tack
`this` to the beginning of everything. Instead of using the class
directly, DI an anonymous function, and declare/return the class inside
of it.
