Skip to content

Commit 8bb3f9b

Browse files
committed
feat(service): bump to angular alpha 48
it now requires rxjs instead of @reactivex/rxjs, and currently version 11 (not >11) because of some bug in the angular alpha 48
1 parent aa6ce1b commit 8bb3f9b

File tree

4 files changed

+28
-22
lines changed

4 files changed

+28
-22
lines changed

karma-test-shim.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ System.config({
1212
defaultJSExtensions: true,
1313
paths: {
1414
'angular2/*': 'node_modules/angular2/*.js',
15-
'@reactivex/rxjs/*': 'node_modules/@reactivex/rxjs/*.js'
15+
'rxjs/*': 'node_modules/rxjs/*.js'
1616
}
1717
});
1818

19-
System.import('angular2/src/core/dom/browser_adapter').then(function(browser_adapter) {
19+
System.import('angular2/src/platform/browser/browser_adapter').then(function(browser_adapter) {
2020
browser_adapter.BrowserDomAdapter.makeCurrent();
2121
}).then(function() {
2222
return Promise.all(

karma.conf.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ module.exports = function(config) {
2525
'node_modules/systemjs/dist/system.src.js',
2626
'node_modules/reflect-metadata/Reflect.js',
2727

28-
{ pattern: 'node_modules/angular2/**/*.js', included: false, watched: false },
29-
{ pattern: 'node_modules/@reactivex/rxjs/dist/**/*.js', included: false, watched: false },
30-
{ pattern: 'node_modules/systemjs/dist/system-polyfills.js', included: false, watched: false }, // PhantomJS2 (and possibly others) might require it
28+
{ pattern: 'node_modules/angular2/**/*.js', included: false, watched: false, served: true },
29+
{ pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false, served: true },
30+
{ pattern: 'node_modules/systemjs/dist/system-polyfills.js', included: false, watched: false, served: true }, // PhantomJS2 (and possibly others) might require it
3131

3232
{ pattern: 'src/**/*.js', included: false, watched: true }, // source files
3333
{ pattern: 'tests/**/*.spec.js', included: false, watched: true }, // test files
@@ -75,7 +75,7 @@ module.exports = function(config) {
7575
singleRun: true,
7676

7777
// Concurrency level
78-
// how many browser should be started simultaneous
78+
// how many browser should be started simultanous
7979
concurrency: Infinity
8080
})
8181
};

package.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,21 @@
2626
"typings": "./ng2-translate.d.ts",
2727
"homepage": "https://github.com/ocombe/ng2-translate",
2828
"dependencies": {
29-
"@reactivex/rxjs": "^5.0.0-alpha.6",
30-
"angular2": "^2.0.0-alpha.46"
29+
"rxjs": "5.0.0-alpha.11",
30+
"angular2": "2.0.0-alpha.48"
3131
},
3232
"devDependencies": {
33-
"commitizen": "^2.4.6",
34-
"cz-conventional-changelog": "^1.1.4",
35-
"es6-shim": "^0.33.13",
33+
"commitizen": "~2.4.6",
34+
"cz-conventional-changelog": "~1.1.4",
35+
"es6-shim": "~0.33.13",
3636
"jasmine-core": "~2.3.4",
37-
"karma": "^0.13.15",
38-
"karma-chrome-launcher": "^0.2.2",
39-
"karma-firefox-launcher": "^0.1.7",
40-
"karma-jasmine": "^0.3.6",
41-
"semantic-release": "^4.3.5",
42-
"systemjs": "^0.19.6",
43-
"typescript": "^1.6.2"
37+
"karma": "~0.13.15",
38+
"karma-chrome-launcher": "~0.2.2",
39+
"karma-firefox-launcher": "~0.1.7",
40+
"karma-jasmine": "~0.3.6",
41+
"semantic-release": "~4.3.5",
42+
"systemjs": "~0.19.6",
43+
"typescript": "~1.6.2"
4444
},
4545
"czConfig": {
4646
"path": "node_modules/cz-conventional-changelog"

src/translate.service.ts

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import {Injectable, EventEmitter} from 'angular2/angular2';
22
import {Http, Response} from 'angular2/http';
33
// doc: https://github.com/ReactiveX/RxJS/blob/master/doc/operator-creation.md
4-
import {Observable} from '@reactivex/rxjs/dist/cjs/Rx';
4+
import {Observable} from 'rxjs/Observable';
5+
// todo just use Observable.of when using rxjs alpha > 11
6+
import {ArrayObservable} from 'rxjs/observable/fromArray'
7+
import 'rxjs/operators/share';
8+
// todo uncomment this once using rxjs alpha > 11
9+
//import 'rxjs/add/operator/share';
10+
511
import {Parser} from './translate.parser';
612

713
interface TranslateLoader {
@@ -100,10 +106,10 @@ export class TranslateService {
100106
});
101107

102108
return pending;
103-
} else { // we have this language, return an observable
109+
} else { // we have this language, return an Observable
104110
this.changeLang(lang);
105111

106-
return Observable.of(this.translations[lang]);
112+
return ArrayObservable.of(this.translations[lang]);
107113
}
108114
}
109115

@@ -151,7 +157,7 @@ export class TranslateService {
151157
if(this.pending) {
152158
return this.pending.map((res: any) => this.parser.interpolate(res[key], interpolateParams) || key);
153159
} else {
154-
return Observable.of(this.translations && this.translations[this.currentLang]
160+
return ArrayObservable.of(this.translations && this.translations[this.currentLang]
155161
? this.parser.interpolate(this.translations[this.currentLang][key], interpolateParams) : key || key);
156162
}
157163
}

0 commit comments

Comments
 (0)