diff --git a/lib/modules/storage/index.js b/lib/modules/storage/index.js index 9fa9e6d0..5a54dc36 100644 --- a/lib/modules/storage/index.js +++ b/lib/modules/storage/index.js @@ -12,6 +12,11 @@ type StorageOptionsType = { }; export default class Storage extends Base { + /** + * + * @param firebase + * @param options + */ constructor(firebase: Object, options: StorageOptionsType = {}) { super(firebase, options); this.subscriptions = {}; @@ -27,27 +32,58 @@ export default class Storage extends Base { ); } + /** + * Returns a reference for the given path in the default bucket. + * @url https://firebase.google.com/docs/reference/js/firebase.storage.Storage#ref + * @param path + * @returns {StorageReference} + */ ref(path: string): StorageRef { return new StorageRef(this, path); } + /** + * Returns a reference for the given absolute URL. + * @url https://firebase.google.com/docs/reference/js/firebase.storage.Storage#refFromURL + * @param url + * @returns {StorageReference} + */ refFromURL(url: string): Promise { + // TODO don't think this is correct? return new StorageRef(this, `url::${url}`); } + /** + * setMaxOperationRetryTime + * @url https://firebase.google.com/docs/reference/js/firebase.storage.Storage#setMaxOperationRetryTime + * @param time The new maximum operation retry time in milliseconds. + */ setMaxOperationRetryTime(time: number) { FirebaseStorage.setMaxOperationRetryTime(time); } + /** + * setMaxUploadRetryTime + * @url https://firebase.google.com/docs/reference/js/firebase.storage.Storage#setMaxUploadRetryTime + * @param time The new maximum upload retry time in milliseconds. + */ setMaxUploadRetryTime(time: number) { FirebaseStorage.setMaxUploadRetryTime(time); } - // additional methods compared to Web API + /** + * setMaxDownloadRetryTime + * @url N/A + * @param time The new maximum download retry time in milliseconds. + */ setMaxDownloadRetryTime(time: number) { FirebaseStorage.setMaxDownloadRetryTime(time); } + /** ********** + * INTERNALS + ********** **/ + _handleStorageEvent(event: Object) { const { path, eventName } = event; const body = event.body || {};