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.4.9.pre.dev public/assets/angular/services/lib/alert_flash.js-7a4fe7ef5510a224677a12ecf2fe973b.es6
aleph_analytics-0.4.9.pre.dev app/assets/javascripts/angular/services/lib/alert_flash.js.es6
aleph_analytics-0.4.8 public/assets/angular/services/lib/alert_flash.js-7a4fe7ef5510a224677a12ecf2fe973b.es6
aleph_analytics-0.4.8 app/assets/javascripts/angular/services/lib/alert_flash.js.es6
aleph_analytics-0.4.7 app/assets/javascripts/angular/services/lib/alert_flash.js.es6
aleph_analytics-0.4.7 public/assets/angular/services/lib/alert_flash.js-7a4fe7ef5510a224677a12ecf2fe973b.es6
aleph_analytics-0.4.4 public/assets/angular/services/lib/alert_flash.js-7a4fe7ef5510a224677a12ecf2fe973b.es6
aleph_analytics-0.4.4 app/assets/javascripts/angular/services/lib/alert_flash.js.es6
aleph_analytics-0.4.2 public/assets/angular/services/lib/alert_flash.js-7a4fe7ef5510a224677a12ecf2fe973b.es6
aleph_analytics-0.4.2 app/assets/javascripts/angular/services/lib/alert_flash.js.es6
aleph_analytics-0.4.1 public/assets/angular/services/lib/alert_flash.js-7a4fe7ef5510a224677a12ecf2fe973b.es6
aleph_analytics-0.4.1 app/assets/javascripts/angular/services/lib/alert_flash.js.es6
aleph_analytics-0.3.0 public/assets/angular/services/lib/alert_flash.js-7a4fe7ef5510a224677a12ecf2fe973b.es6
aleph_analytics-0.3.0 app/assets/javascripts/angular/services/lib/alert_flash.js.es6
aleph_analytics-0.2.0 app/assets/javascripts/angular/services/lib/alert_flash.js.es6
aleph_analytics-0.2.0 public/assets/angular/services/lib/alert_flash.js-7a4fe7ef5510a224677a12ecf2fe973b.es6
aleph_analytics-0.1.0 public/assets/angular/services/lib/alert_flash.js-7a4fe7ef5510a224677a12ecf2fe973b.es6
aleph_analytics-0.1.0 app/assets/javascripts/angular/services/lib/alert_flash.js.es6
aleph_analytics-0.0.6 public/assets/angular/services/lib/alert_flash.js-7a4fe7ef5510a224677a12ecf2fe973b.es6
aleph_analytics-0.0.6 app/assets/javascripts/angular/services/lib/alert_flash.js.es6