@pisell/utils 1.0.25 → 1.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/firebase/index.d.ts +5 -1
- package/es/firebase/index.js +2 -2
- package/lib/firebase/index.d.ts +5 -1
- package/lib/firebase/index.js +10 -0
- package/package.json +1 -1
package/es/firebase/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { FirebaseApp } from 'firebase/app';
|
|
2
|
+
import { Auth } from 'firebase/auth';
|
|
3
|
+
import { ref, Database, goOnline, goOffline } from 'firebase/database';
|
|
2
4
|
declare let firebaseApp: FirebaseApp;
|
|
5
|
+
declare let auth: Auth;
|
|
6
|
+
declare let database: Database;
|
|
3
7
|
export declare const initFirebase: (config?: any) => void;
|
|
4
|
-
export { firebaseApp };
|
|
8
|
+
export { database, firebaseApp, auth, ref, goOnline, goOffline };
|
|
5
9
|
export declare const getPath: (path: string) => string;
|
|
6
10
|
export declare const setAuthStateChangeCallback: (callback: (user: any) => void) => void;
|
|
7
11
|
export declare const signUp: (email: string, password: string) => Promise<import("firebase/auth").User>;
|
package/es/firebase/index.js
CHANGED
|
@@ -5,7 +5,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
5
5
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
6
6
|
import { initializeApp } from 'firebase/app';
|
|
7
7
|
import { getAuth, createUserWithEmailAndPassword, signInWithEmailAndPassword, signOut } from 'firebase/auth';
|
|
8
|
-
import { getDatabase, ref, set, get, off, onValue, onChildChanged } from 'firebase/database';
|
|
8
|
+
import { getDatabase, ref, set, get, off, onValue, onChildChanged, goOnline, goOffline } from 'firebase/database';
|
|
9
9
|
import { firebaseConfig } from "./config";
|
|
10
10
|
import { isUndefined } from "../typeUtils";
|
|
11
11
|
var isClient = typeof window != "undefined" && window.document;
|
|
@@ -30,7 +30,7 @@ if (isClient && window.__wxjs_environment !== "miniprogram" && isDefaultInit) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
// 导出 Firebase 配置,以便在需要时进行访问
|
|
33
|
-
export { firebaseApp };
|
|
33
|
+
export { database, firebaseApp, auth, ref, goOnline, goOffline };
|
|
34
34
|
|
|
35
35
|
// 配置化 Firebase 路径
|
|
36
36
|
export var getPath = function getPath(path) {
|
package/lib/firebase/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { FirebaseApp } from 'firebase/app';
|
|
2
|
+
import { Auth } from 'firebase/auth';
|
|
3
|
+
import { ref, Database, goOnline, goOffline } from 'firebase/database';
|
|
2
4
|
declare let firebaseApp: FirebaseApp;
|
|
5
|
+
declare let auth: Auth;
|
|
6
|
+
declare let database: Database;
|
|
3
7
|
export declare const initFirebase: (config?: any) => void;
|
|
4
|
-
export { firebaseApp };
|
|
8
|
+
export { database, firebaseApp, auth, ref, goOnline, goOffline };
|
|
5
9
|
export declare const getPath: (path: string) => string;
|
|
6
10
|
export declare const setAuthStateChangeCallback: (callback: (user: any) => void) => void;
|
|
7
11
|
export declare const signUp: (email: string, password: string) => Promise<import("firebase/auth").User>;
|
package/lib/firebase/index.js
CHANGED
|
@@ -19,13 +19,18 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
// src/firebase/index.ts
|
|
20
20
|
var firebase_exports = {};
|
|
21
21
|
__export(firebase_exports, {
|
|
22
|
+
auth: () => auth,
|
|
23
|
+
database: () => database,
|
|
22
24
|
default: () => firebase_default,
|
|
23
25
|
firebaseApp: () => firebaseApp,
|
|
24
26
|
getPath: () => getPath,
|
|
27
|
+
goOffline: () => import_database.goOffline,
|
|
28
|
+
goOnline: () => import_database.goOnline,
|
|
25
29
|
initFirebase: () => initFirebase,
|
|
26
30
|
onDataChange: () => onDataChange,
|
|
27
31
|
onDataChanged: () => onDataChanged,
|
|
28
32
|
readData: () => readData,
|
|
33
|
+
ref: () => import_database.ref,
|
|
29
34
|
removeDataListener: () => removeDataListener,
|
|
30
35
|
setAuthStateChangeCallback: () => setAuthStateChangeCallback,
|
|
31
36
|
signInUser: () => signInUser,
|
|
@@ -133,12 +138,17 @@ var firebase_default = {
|
|
|
133
138
|
};
|
|
134
139
|
// Annotate the CommonJS export names for ESM import in node:
|
|
135
140
|
0 && (module.exports = {
|
|
141
|
+
auth,
|
|
142
|
+
database,
|
|
136
143
|
firebaseApp,
|
|
137
144
|
getPath,
|
|
145
|
+
goOffline,
|
|
146
|
+
goOnline,
|
|
138
147
|
initFirebase,
|
|
139
148
|
onDataChange,
|
|
140
149
|
onDataChanged,
|
|
141
150
|
readData,
|
|
151
|
+
ref,
|
|
142
152
|
removeDataListener,
|
|
143
153
|
setAuthStateChangeCallback,
|
|
144
154
|
signInUser,
|