diff --git a/karma-test-shim.js b/karma-test-shim.js index 657eb9cd..7d39ab87 100644 --- a/karma-test-shim.js +++ b/karma-test-shim.js @@ -12,11 +12,11 @@ System.config({ defaultJSExtensions: true, paths: { 'angular2/*': 'node_modules/angular2/*.js', - '@reactivex/rxjs/*': 'node_modules/@reactivex/rxjs/*.js' + 'rxjs/*': 'node_modules/rxjs/*.js' } }); -System.import('angular2/src/core/dom/browser_adapter').then(function(browser_adapter) { +System.import('angular2/src/platform/browser/browser_adapter').then(function(browser_adapter) { browser_adapter.BrowserDomAdapter.makeCurrent(); }).then(function() { return Promise.all( diff --git a/karma.conf.js b/karma.conf.js index 119a6b26..58f3b51b 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -25,9 +25,9 @@ module.exports = function(config) { 'node_modules/systemjs/dist/system.src.js', 'node_modules/reflect-metadata/Reflect.js', - { pattern: 'node_modules/angular2/**/*.js', included: false, watched: false }, - { pattern: 'node_modules/@reactivex/rxjs/dist/**/*.js', included: false, watched: false }, - { pattern: 'node_modules/systemjs/dist/system-polyfills.js', included: false, watched: false }, // PhantomJS2 (and possibly others) might require it + { pattern: 'node_modules/angular2/**/*.js', included: false, watched: false, served: true }, + { pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false, served: true }, + { pattern: 'node_modules/systemjs/dist/system-polyfills.js', included: false, watched: false, served: true }, // PhantomJS2 (and possibly others) might require it { pattern: 'src/**/*.js', included: false, watched: true }, // source files { pattern: 'tests/**/*.spec.js', included: false, watched: true }, // test files @@ -75,7 +75,7 @@ module.exports = function(config) { singleRun: true, // Concurrency level - // how many browser should be started simultaneous + // how many browser should be started simultanous concurrency: Infinity }) }; diff --git a/package.json b/package.json index 2c746a89..f738bd8a 100644 --- a/package.json +++ b/package.json @@ -26,21 +26,21 @@ "typings": "./ng2-translate.d.ts", "homepage": "https://github.com/ocombe/ng2-translate", "dependencies": { - "@reactivex/rxjs": "^5.0.0-alpha.6", - "angular2": "^2.0.0-alpha.46" + "rxjs": "5.0.0-alpha.11", + "angular2": "2.0.0-alpha.48" }, "devDependencies": { - "commitizen": "^2.4.6", - "cz-conventional-changelog": "^1.1.4", - "es6-shim": "^0.33.13", + "commitizen": "~2.4.6", + "cz-conventional-changelog": "~1.1.4", + "es6-shim": "~0.33.13", "jasmine-core": "~2.3.4", - "karma": "^0.13.15", - "karma-chrome-launcher": "^0.2.2", - "karma-firefox-launcher": "^0.1.7", - "karma-jasmine": "^0.3.6", - "semantic-release": "^4.3.5", - "systemjs": "^0.19.6", - "typescript": "^1.6.2" + "karma": "~0.13.15", + "karma-chrome-launcher": "~0.2.2", + "karma-firefox-launcher": "~0.1.7", + "karma-jasmine": "~0.3.6", + "semantic-release": "~4.3.5", + "systemjs": "~0.19.6", + "typescript": "~1.6.2" }, "czConfig": { "path": "node_modules/cz-conventional-changelog" diff --git a/src/translate.service.ts b/src/translate.service.ts index 112f2f05..6484f62e 100644 --- a/src/translate.service.ts +++ b/src/translate.service.ts @@ -1,7 +1,13 @@ import {Injectable, EventEmitter} from 'angular2/angular2'; import {Http, Response} from 'angular2/http'; // doc: https://github.com/ReactiveX/RxJS/blob/master/doc/operator-creation.md -import {Observable} from '@reactivex/rxjs/dist/cjs/Rx'; +import {Observable} from 'rxjs/Observable'; +// todo just use Observable.of when using rxjs alpha > 11 +import {ArrayObservable} from 'rxjs/observable/fromArray' +import 'rxjs/operators/share'; +// todo uncomment this once using rxjs alpha > 11 +//import 'rxjs/add/operator/share'; + import {Parser} from './translate.parser'; interface TranslateLoader { @@ -100,10 +106,10 @@ export class TranslateService { }); return pending; - } else { // we have this language, return an observable + } else { // we have this language, return an Observable this.changeLang(lang); - return Observable.of(this.translations[lang]); + return ArrayObservable.of(this.translations[lang]); } } @@ -151,7 +157,7 @@ export class TranslateService { if(this.pending) { return this.pending.map((res: any) => this.parser.interpolate(res[key], interpolateParams) || key); } else { - return Observable.of(this.translations && this.translations[this.currentLang] + return ArrayObservable.of(this.translations && this.translations[this.currentLang] ? this.parser.interpolate(this.translations[this.currentLang][key], interpolateParams) : key || key); } }