How to use aurelia-event-aggregator - 10 common examples

To help you get started, we’ve selected a few aurelia-event-aggregator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ghiscoding / aurelia-slickgrid / src / aurelia-slickgrid / services / __tests__ / filter.service.spec.ts View on Github external
beforeEach(() => {
    // define a <div> container to simulate a row detail DOM element
    const div = document.createElement('div');
    div.innerHTML = `<div id="${DOM_ELEMENT_ID}">some text</div>`;
    document.body.appendChild(div);

    ea = new EventAggregator();
    sharedService = new SharedService();
    container = new Container();
    const filterFactory = new FilterFactory(container, new SlickgridConfig());
    service = new FilterService(ea, filterFactory, sharedService);
    slickgridEventHandler = service.eventHandler;
  });
</div>
github ghiscoding / aurelia-slickgrid / src / aurelia-slickgrid / services / __tests__ / export.service.spec.ts View on Github external
beforeEach(() => {
      ea = new EventAggregator();
      i18n = new I18N(ea, new BindingSignaler());

      // @ts-ignore
      navigator.__defineGetter__('appName', () => 'Netscape');
      navigator.msSaveOrOpenBlob = undefined;
      mockCsvBlob = new Blob(['', ''], { type: `text/csv;charset=utf-8;` });
      mockTxtBlob = new Blob(['\uFEFF', ''], { type: `text/plain;charset=utf-8;` });

      mockExportCsvOptions = {
        delimiter: DelimiterType.comma,
        filename: 'export',
        format: FileType.csv,
        useUtf8WithBom: false,
      };

      mockExportTxtOptions = {
github ghiscoding / aurelia-slickgrid / src / aurelia-slickgrid / services / __tests__ / excelExport.service.spec.ts View on Github external
beforeEach(() => {
      ea = new EventAggregator();
      i18n = new I18N(ea, new BindingSignaler());

      // @ts-ignore
      navigator.__defineGetter__('appName', () => 'Netscape');
      navigator.msSaveOrOpenBlob = undefined;
      mockExcelBlob = new Blob(['', ''], { type: `text/xlsx;charset=utf-8;` });

      mockExportExcelOptions = {
        filename: 'export',
        format: FileType.xlsx,
      };

      i18n.setup({
        resources: {
          en: {
            translation: {
github buttonwoodcx / bcx-aurelia-dnd / test / dnd.spec.js View on Github external
import {EventAggregator} from 'aurelia-event-aggregator';
import {DndService} from '../src/dnd-service';

const doc = document;
const documentElement = doc.documentElement;

let node = doc.createElement('style');
node.innerHTML = `
.test-class {
  display: block;
}
`;
node.type = 'text/css';
doc.head.appendChild(node);

const ea = new EventAggregator();
const dndService = new DndService(ea);

// copied from dragula test/lib/events.js
function fireEvent(el, type, options) {
  var o = options || {};
  var e = document.createEvent('Event');
  e.initEvent(type, true, true);
  Object.keys(o).forEach(apply);
  el.dispatchEvent(e);
  function apply (key) {
    e[key] = o[key];
  }
}

function addBox(label, x, y, width, height) {
  const dom = $('<div style="position:absolute;"></div>');
github stamp-web / stamp-web-aurelia / src / main.js View on Github external
function getLang() {
    // Ideally we should DI these objects.  Investigate how we could do this at this early phase of the app
    let httpClient = new HttpClient();
    let eventBus = new EventAggregator();
    let prefs = new Preferences(httpClient,eventBus);
    return new Promise( (resolve,reject) => {
        if( prefs ) {
            prefs.find({
                $filter: "(category eq 'user') and (name eq 'locale')"
            }).then(result => {
                let lang = 'en';
                if( !_.isEmpty(result) ) {
                    lang = _.first(result.models).value;
                }
                resolve(lang);
            }).catch( e => {
                reject(new Error("Failure querying preferences"));
            });
        } else {
            reject(new Error("Preferences services is not available"));
github ghiscoding / aurelia-slickgrid / src / aurelia-slickgrid / services / __tests__ / gridState.service.spec.ts View on Github external
beforeEach(() => {
    ea = new EventAggregator();
    service = new GridStateService(ea, extensionServiceStub, filterServiceStub, sortServiceStub);
    service.init(gridStub);
  });
github zewa666 / aurelia-i18next / test / unit / i18n.update-translations.spec.js View on Github external
it('should not update translations if no attributes defined in options', (done) => {
    ea  = new EventAggregator();
    sut = new I18N(ea);
    sut.setup({
      resStore: resources,
      lng: 'en',
      getAsync: false,
      sendMissing: false,
      fallbackLng: 'en',
      debug: false
    });

    //load the the html fixture
    System.import('fixture:template.html!text').then((result) => {
      template           = document.createElement("div");
      template.innerHTML = result;
      if (template.firstChild instanceof HTMLTemplateElement) template.innerHTML = template.firstChild.innerHTML;
      document.body.appendChild(template);
github ghiscoding / aurelia-slickgrid / src / aurelia-slickgrid / services / __tests__ / grid.service.spec.ts View on Github external
beforeEach(() => {
    ea = new EventAggregator();
    service = new GridService(ea, extensionServiceStub, filterServiceStub, gridStateServiceStub, sortServiceStub);
    service.init(gridStub, dataviewStub);
  });
github ghiscoding / aurelia-slickgrid / src / aurelia-slickgrid / services / __tests__ / utilities.spec.ts View on Github external
it('should return unique values when input array has duplicate objects', () => {
      const subscriptions: Subscription[] = [];
      const ea1 = new EventAggregator();
      const ea2 = new EventAggregator();
      subscriptions.push(ea1.subscribe('test', () => { }), ea2.subscribe('test', () => { }));
      const output = disposeAllSubscriptions(subscriptions);
      expect(output).toHaveLength(0);
    });
  });
github ghiscoding / aurelia-slickgrid / src / aurelia-slickgrid / extensions / __tests__ / rowDetailViewExtension.spec.ts View on Github external
beforeEach(() => {
    ea = new EventAggregator();
    sharedService = new SharedService();
    extensionUtility = new ExtensionUtility({ tr: jest.fn() } as unknown as I18N, sharedService);
    extension = new RowDetailViewExtension(aureliaUtilServiceStub, ea, extensionUtility, sharedService);
  });

aurelia-event-aggregator

A lightweight pub/sub messaging system for app-wide or per-object loosely coupled events.

MIT
Latest version published 6 years ago

Package Health Score

56 / 100
Full package analysis

Popular aurelia-event-aggregator functions