aurelia-breeze icon indicating copy to clipboard operation
aurelia-breeze copied to clipboard

Return the instance of breeze from the Configure Method

Open Vaccano opened this issue 8 years ago • 2 comments

This file https://github.com/jdanyow/aurelia-breeze/blob/master/dist/aurelia-breeze.js, has a method called configure.

The only way I have found to get webpack and aurelia-breeze to work together involves modifying this file to return the instance of breeze that is configured in there. I then can use that instance in my application.

Would you be willing to make this modification. It can be done by adding:

 return breeze;

as the last line before the method closes? (Right after adapter.setHttpClientFactory(() => frameworkConfig.container.get(HttpClient));.)

Vaccano avatar Aug 09 '16 21:08 Vaccano

Incase you are wondering, this is what I do in my app

import {configure as configureAureliaBreeze} from 'aurelia-breeze';
import {Container} from 'aurelia-dependency-injection';         
var breeze: any;

export class MyClassThatUsesBreeze {

      private entityManager: breeze.EntityManager;
      private metadataStore: breeze.MetadataStore;

      initialize() {
            breeze = configureAureliaBreeze({ container: Container.instance, globalResources: () => { } });
            // other stuff to setup the MetadataStore and EntityManager (and initialize my class).
      }
}

Vaccano avatar Aug 09 '16 21:08 Vaccano

I found a way around this!

I add this to my main.ts and it adds a global instance of breeze that makes this change unnecessary:

require('expose?breeze!breeze-client/breeze.debug');

(This is only needed for Webpack.) Here is the answer on stackoverflow that showed me this.

Vaccano avatar Aug 22 '16 16:08 Vaccano