Skip to content

Commit 002d9ed

Browse files
vicbjeffbcross
authored andcommitted
Misc minor changes (angular#205)
* refactor(providers): allow offline compilation * chore(npm): automatically install typings on npm i
1 parent 8193ebd commit 002d9ed

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"test": "npm run build; karma start",
99
"docs": "typedoc --out docs/api/ --module commonjs --mode modules --name AngularFire2 src",
1010
"build": "rm -rf dist; tsc",
11-
"build_npm": "rm -rf dist && ./node_modules/.bin/tsc -p tsconfig.publish.es5.json && ./node_modules/.bin/tsc -p tsconfig.publish.es6.json",
11+
"build_npm": "rm -rf dist && tsc -p tsconfig.publish.es5.json && tsc -p tsconfig.publish.es6.json",
1212
"postbuild_npm": "cp manual_typings/firebase3/firebase3.d.ts package.json README.md .npmignore dist/ && npm run rewrite_npm_package",
1313
"rewrite_npm_package": "node --harmony_destructuring tools/rewrite-published-package.js",
1414
"build_bundle": "cp -r src angularfire2 && tsc typings/main.d.ts angularfire2.ts --rootDir . --module system -t es5 --outFile dist/bundles/angularfire2.js --moduleResolution node --emitDecoratorMetadata --experimentalDecorators",

src/angularfire2.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,32 +31,37 @@ export class AngularFire {
3131
}
3232

3333
export const COMMON_PROVIDERS: any[] = [
34-
provide(FirebaseApp, {
35-
useFactory: (config: FirebaseAppConfig) => {
36-
return initializeApp(config);
37-
},
38-
deps: [FirebaseConfig]}),
3934
// TODO: Deprecate
4035
provide(FirebaseAuth, {
4136
useExisting: AngularFireAuth
4237
}),
38+
{
39+
provide: FirebaseApp,
40+
useFactory: _getFirebase,
41+
deps: [FirebaseConfig]
42+
},
4343
AngularFireAuth,
4444
AngularFire,
45-
FirebaseDatabase,
45+
FirebaseDatabase
4646
];
4747

48-
function _getFirebase(url:string): Firebase {
49-
return new Firebase(url);
48+
function _getFirebase(config: FirebaseAppConfig): firebase.app.App {
49+
return initializeApp(config);
5050
}
5151

5252
export const FIREBASE_PROVIDERS:any[] = [
5353
COMMON_PROVIDERS,
54-
provide(AuthBackend, {
55-
useFactory: (app: firebase.app.App) => new FirebaseSdkAuthBackend(app, false),
54+
{
55+
provide: AuthBackend,
56+
useFactory: _getAuthBackend,
5657
deps: [FirebaseApp]
57-
})
58+
}
5859
];
5960

61+
function _getAuthBackend(app: firebase.app.App): FirebaseSdkAuthBackend {
62+
return new FirebaseSdkAuthBackend(app, false);
63+
}
64+
6065
/**
6166
* Used to define the default Firebase root location to be
6267
* used throughout an application.

0 commit comments

Comments
 (0)