this
JS-010567 * @param {string} path - The path of the file to delete.
68 * @returns {Promise<[boolean, string | Error]>} A promise containing deletion status and download URL (if successful).
69 */
70 async deleteFile (path) {71 try {
72 const storageRef = ref(storage, path)
73 await deleteObject(storageRef)
51 * @param {string} path - The path of the file.
52 * @returns {Promise<[boolean, string | Error]>} A promise containing retrieval status and download URL (if successful).
53 */
54 async getDownloadURL (path) {55 try {
56 const storageRef = ref(storage, path)
57 const downloadURL = await getDownloadURL(storageRef)
34 * @param {string} path - The path to store the file.
35 * @returns {Promise<[boolean, string | Error]>} A promise containing upload status and download URL (if successful).
36 */
37 async uploadFile (file, path) {38 try {
39 const storageRef = ref(storage, path)
40 const snapshot = await storageRef.put(file)
101 return request
102 }
103
104 async getUsers () {105 const listUsersResult = await auth.listUsers()
106 const users = await Promise.all(
107 listUsersResult.users.map(async (userRecord) => {
96 return userCreds
97 }
98
99 async resetPassword (email) {100 const request = await auth.sendPasswordResetEmail(email)
101 return request
102 }
If a class method does not use this
, it can sometimes be made into a static function. If you do convert the method into a static function, instances of the class that call that particular method have to be converted to a static call as well (MyClass.callStaticMethod())
class Person {
sayHi() {
const greeting = document.createElement("div");
greeting.innerText = "Hello!";
document.appendChild();
}
}
const person = new Person();
person.sayHi();
class Person {
static sayHi() {
const greeting = document.createElement("div");
greeting.innerText = "Hello!";
document.appendChild();
}
}
Person.sayHi();