Skip to content

Commit

Permalink
feat(service): bump to angular alpha 48
Browse files Browse the repository at this point in the history
it now requires rxjs instead of @reactivex/rxjs, and currently version 11 (not >11) because of some

bug in the angular alpha 48
  • Loading branch information
ocombe committed Dec 9, 2015
1 parent aa6ce1b commit 8bb3f9b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 22 deletions.
4 changes: 2 additions & 2 deletions karma-test-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 4 additions & 4 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
})
};
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 10 additions & 4 deletions src/translate.service.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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]);
}
}

Expand Down Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 8bb3f9b

Please sign in to comment.