Skip to content

Commit b56982e

Browse files
vicbdavideast
authored andcommitted
Misc minor changes (angular#205)
* refactor(providers): allow offline compilation * chore(npm): automatically install typings on npm i
1 parent 6b3548f commit b56982e

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
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 package.json README.md .npmignore dist/ && npm run rewrite_npm_package",
13+
"postinstall": "typings install",
1314
"rewrite_npm_package": "node --harmony_destructuring tools/rewrite-published-package.js",
1415
"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"
1516
},

src/angularfire2.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,33 @@ function getAbsUrl (root:string, url:string) {
3838
}
3939

4040
export const COMMON_PROVIDERS: any[] = [
41-
provide(FirebaseRef, {
42-
useFactory: (url:string) => new Firebase(url),
43-
deps: [FirebaseUrl]}),
41+
{
42+
provide: FirebaseRef,
43+
useFactory: _getFirebase,
44+
deps: [FirebaseUrl]
45+
},
4446
FirebaseAuth,
4547
AngularFire,
4648
FirebaseDatabase
4749
];
4850

51+
function _getFirebase(url:string): Firebase {
52+
return new Firebase(url);
53+
}
54+
4955
export const FIREBASE_PROVIDERS:any[] = [
5056
COMMON_PROVIDERS,
51-
provide(AuthBackend, {
52-
useFactory: (ref: Firebase) => new FirebaseSdkAuthBackend(ref, false),
57+
{
58+
provide: AuthBackend,
59+
useFactory: _getAuthBackend,
5360
deps: [FirebaseRef]
54-
})
61+
}
5562
];
5663

64+
function _getAuthBackend(ref: Firebase): FirebaseSdkAuthBackend {
65+
return new FirebaseSdkAuthBackend(ref, false);
66+
}
67+
5768
/**
5869
* Used to define the default Firebase root location to be
5970
* used throughout an application.

0 commit comments

Comments
 (0)