File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,28 @@ import * as TEST_ACCESS from './src/api/test_access';
2525import { isNodeSdk } from '@firebase/util' ;
2626import './src/nodePatches' ;
2727
28+ /**
29+ * A one off register function which returns a database based on the app and
30+ * passed database URL.
31+ *
32+ * @param app A valid FirebaseApp-like object
33+ * @param url A valid Firebase databaseURL
34+ */
35+ export function initStandalone ( app , url ) {
36+ return {
37+ instance : RepoManager . getInstance ( ) . databaseFromApp ( app , url ) ,
38+ namespace : {
39+ Reference,
40+ Query,
41+ Database,
42+ enableLogging,
43+ INTERNAL ,
44+ ServerValue : Database . ServerValue ,
45+ TEST_ACCESS
46+ }
47+ } ;
48+ }
49+
2850export function registerDatabase ( instance : FirebaseNamespace ) {
2951 // Register the Database Service with the 'firebase' namespace.
3052 const namespace = instance . INTERNAL . registerService (
@@ -45,7 +67,7 @@ export function registerDatabase(instance: FirebaseNamespace) {
4567 ) ;
4668
4769 if ( isNodeSdk ( ) ) {
48- module . exports = namespace ;
70+ module . exports = Object . assign ( { } , namespace , { initStandalone } ) ;
4971 }
5072}
5173
You can’t perform that action at this time.
0 commit comments