Без опису
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

app-compat-public.d.ts 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. import { Compat } from '@firebase/util';
  2. import { Component } from '@firebase/component';
  3. import { LogCallback } from '@firebase/logger';
  4. import { LogLevelString } from '@firebase/logger';
  5. import { LogOptions } from '@firebase/logger';
  6. import { Name } from '@firebase/component';
  7. declare const firebase: FirebaseNamespace;
  8. export default firebase;
  9. /**
  10. * This interface will be enhanced by other products by adding e.g. firestore(), messaging() methods.
  11. * As a result, FirebaseAppImpl can't directly implement it, otherwise there will be typings errors:
  12. *
  13. * For example, "Class 'FirebaseAppImpl' incorrectly implements interface 'FirebaseApp'.
  14. * Property 'installations' is missing in type 'FirebaseAppImpl' but required in type 'FirebaseApp'"
  15. *
  16. * To workaround this issue, we defined a _FirebaseApp interface which is implemented by FirebaseAppImpl
  17. * and let FirebaseApp extends it.
  18. */
  19. export declare interface FirebaseApp extends _FirebaseApp {
  20. }
  21. declare interface _FirebaseApp {
  22. /**
  23. * The (read-only) name (identifier) for this App. '[DEFAULT]' is the default
  24. * App.
  25. */
  26. name: string;
  27. /**
  28. * The (read-only) configuration options from the app initialization.
  29. */
  30. options: FirebaseOptions;
  31. /**
  32. * The settable config flag for GDPR opt-in/opt-out
  33. */
  34. automaticDataCollectionEnabled: boolean;
  35. /**
  36. * Make the given App unusable and free resources.
  37. */
  38. delete(): Promise<void>;
  39. }
  40. declare interface FirebaseAppConfig {
  41. name?: string;
  42. automaticDataCollectionEnabled?: boolean;
  43. }
  44. declare interface FirebaseAppContructor {
  45. new (): FirebaseApp;
  46. }
  47. export declare interface FirebaseNamespace {
  48. /**
  49. * Create (and initialize) a FirebaseApp.
  50. *
  51. * @param options Options to configure the services used in the App.
  52. * @param config The optional config for your firebase app
  53. */
  54. initializeApp(options: FirebaseOptions, config?: FirebaseAppConfig): FirebaseApp;
  55. /**
  56. * Create (and initialize) a FirebaseApp.
  57. *
  58. * @param options Options to configure the services used in the App.
  59. * @param name The optional name of the app to initialize ('[DEFAULT]' if
  60. * omitted)
  61. */
  62. initializeApp(options: FirebaseOptions, name?: string): FirebaseApp;
  63. app: {
  64. /**
  65. * Retrieve an instance of a FirebaseApp.
  66. *
  67. * Usage: firebase.app()
  68. *
  69. * @param name The optional name of the app to return ('[DEFAULT]' if omitted)
  70. */
  71. (name?: string): FirebaseApp;
  72. /**
  73. * For testing FirebaseApp instances:
  74. * app() instanceof firebase.app.App
  75. *
  76. * DO NOT call this constuctor directly (use firebase.app() instead).
  77. */
  78. App: FirebaseAppContructor;
  79. };
  80. /**
  81. * A (read-only) array of all the initialized Apps.
  82. */
  83. apps: FirebaseApp[];
  84. /**
  85. * Registers a library's name and version for platform logging purposes.
  86. * @param library Name of 1p or 3p library (e.g. firestore, angularfire)
  87. * @param version Current version of that library.
  88. */
  89. registerVersion(library: string, version: string, variant?: string): void;
  90. setLogLevel(logLevel: LogLevelString): void;
  91. onLog(logCallback: LogCallback, options?: LogOptions): void;
  92. SDK_VERSION: string;
  93. }
  94. export declare interface _FirebaseNamespace extends FirebaseNamespace {
  95. INTERNAL: {
  96. /**
  97. * Internal API to register a Firebase Service into the firebase namespace.
  98. *
  99. * Each service will create a child namespace (firebase.<name>) which acts as
  100. * both a namespace for service specific properties, and also as a service
  101. * accessor function (firebase.<name>() or firebase.<name>(app)).
  102. *
  103. * @param name The Firebase Service being registered.
  104. * @param createService Factory function to create a service instance.
  105. * @param serviceProperties Properties to copy to the service's namespace.
  106. * @param appHook All appHooks called before initializeApp returns to caller.
  107. * @param allowMultipleInstances Whether the registered service supports
  108. * multiple instances per app. If not specified, the default is false.
  109. */
  110. registerComponent<T extends Name>(component: Component<T>): FirebaseServiceNamespace<_FirebaseService> | null;
  111. /**
  112. * Internal API to remove an app from the list of registered apps.
  113. */
  114. removeApp(name: string): void;
  115. useAsService(app: FirebaseApp, serviceName: string): string | null;
  116. [index: string]: unknown;
  117. };
  118. }
  119. declare interface FirebaseOptions {
  120. apiKey?: string;
  121. authDomain?: string;
  122. databaseURL?: string;
  123. projectId?: string;
  124. storageBucket?: string;
  125. messagingSenderId?: string;
  126. appId?: string;
  127. measurementId?: string;
  128. }
  129. export declare interface _FirebaseService extends Compat<unknown> {
  130. app: FirebaseApp;
  131. INTERNAL?: FirebaseServiceInternals;
  132. }
  133. declare interface FirebaseServiceInternals {
  134. /**
  135. * Delete the service and free it's resources - called from
  136. * app.delete().
  137. */
  138. delete(): Promise<void>;
  139. }
  140. /**
  141. * All ServiceNamespaces extend from FirebaseServiceNamespace
  142. */
  143. declare interface FirebaseServiceNamespace<T extends _FirebaseService> {
  144. (app?: FirebaseApp): T;
  145. }
  146. export { }