Sha256: f6341088ec81cf23d851e89285722371b63c45fdfbba85a62e1120746b93b409

Contents?: true

Size: 855 Bytes

Versions: 32

Compression:

Stored size: 855 Bytes

Contents

!(angular => {
  'use strict';

  class AlertFlash {
    constructor($rootScope) {
      this._$rootScope = $rootScope;
      this.emitSuccess = _.partial(this.emit, 'success');
      this.emitInfo = _.partial(this.emit, 'info');
      this.emitWarning = _.partial(this.emit, 'warning');
      this.emitDanger = _.partial(this.emit, 'danger');
    }

    emit(type, message, schedule) {
      this._$rootScope.$broadcast(schedule ? 'scheduleAlert' : 'setAlert', {
        type: type,
        message: message
      });
    }

    // use this if you need to surface raw error to user
    emitError(message, error) {
      let e =  ' => ' + (_.exists(error) ? error : '');
      this.emitDanger(message + e);
    }
  }

  AlertFlash.$inject = ['$rootScope'];
  angular.module('alephServices.alertFlash', []).service('AlertFlash', AlertFlash);

}(angular));

Version data entries

32 entries across 16 versions & 1 rubygems

Version Path
aleph_analytics-0.0.5 app/assets/javascripts/angular/services/lib/alert_flash.js.es6
aleph_analytics-0.0.5 public/assets/angular/services/lib/alert_flash.js-7a4fe7ef5510a224677a12ecf2fe973b.es6
aleph_analytics-0.0.4 app/assets/javascripts/angular/services/lib/alert_flash.js.es6
aleph_analytics-0.0.4 public/assets/angular/services/lib/alert_flash.js-7a4fe7ef5510a224677a12ecf2fe973b.es6
aleph_analytics-0.0.3 public/assets/angular/services/lib/alert_flash.js-7a4fe7ef5510a224677a12ecf2fe973b.es6
aleph_analytics-0.0.3 app/assets/javascripts/angular/services/lib/alert_flash.js.es6
aleph_analytics-0.0.2 public/assets/angular/services/lib/alert_flash.js-7a4fe7ef5510a224677a12ecf2fe973b.es6
aleph_analytics-0.0.2 app/assets/javascripts/angular/services/lib/alert_flash.js.es6
aleph_analytics-0.0.1.alpha app/assets/javascripts/angular/services/lib/alert_flash.js.es6
aleph_analytics-0.0.1.alpha public/assets/angular/services/lib/alert_flash.js-7a4fe7ef5510a224677a12ecf2fe973b.es6
aleph_analytics-0.0.0.alpha public/assets/angular/services/lib/alert_flash.js-7a4fe7ef5510a224677a12ecf2fe973b.es6
aleph_analytics-0.0.0.alpha app/assets/javascripts/angular/services/lib/alert_flash.js.es6