From 96b4a47a523d83e8d077bfc29588de075838e347 Mon Sep 17 00:00:00 2001 From: nico Date: Thu, 29 Jun 2017 18:30:52 +0200 Subject: [PATCH] reverted local docs change --- docs/modules/storage.md | 87 ++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 45 deletions(-) diff --git a/docs/modules/storage.md b/docs/modules/storage.md index 55a59597..2371ff3d 100644 --- a/docs/modules/storage.md +++ b/docs/modules/storage.md @@ -9,14 +9,14 @@ providing some iOS and Android specific functionality. ```javascript firebase.storage() - .ref('/files/1234') - .putFile('/path/to/file/1234') - .then(uploadedFile => { - //success - }) - .catch(err => { - //Error - }); +.ref('/files/1234') +.putFile('/path/to/file/1234') +.then(uploadedFile => { +//success +}) +.catch(err => { +//Error +}); ``` @@ -24,31 +24,28 @@ firebase.storage() ```javascript const metadata = { - contentType: 'image/jpeg' +contentType: 'image/jpeg' } firebase.storage() - .ref('/files/1234') - .putFile('/path/to/file/1234', metadata) +.ref('/files/1234') +.putFile('/path/to/file/1234', metadata) ``` ### Listen to upload state ```javascript -const uploadTask = firebase.storage() - .ref('/files/1234') - .putFile('/path/to/file/1234'); - -const unsubscribe = uploadTask.on('state_changed', snapshot => { - //Current upload state - }, null, uploadedFile => { - //Success - unsubscribe(); - }); - -uploadTask.catch(err => { - //Error - unsubscribe(); - }); +const unsubscribe = firebase.storage() +.ref('/files/1234') +.putFile('/path/to/file/1234') +.on('state_changed', snapshot => { +//Current upload state +}, err => { +//Error +unsubscribe(); +}, uploadedFile => { +//Success +unsubscribe(); +}); ``` ## Downloading files @@ -57,31 +54,31 @@ uploadTask.catch(err => { ```javascript firebase.storage() - .ref('/files/1234') - .downloadFile('/path/to/save/file') - .then(downloadedFile => { - //success - }) - .catch(err => { - //Error - }); +.ref('/files/1234') +.downloadFile('/path/to/save/file') +.then(downloadedFile => { +//success +}) +.catch(err => { +//Error +}); ``` ### Listen to download state ```javascript const unsubscribe = firebase.storage() - .ref('/files/1234') - .downloadFile('/path/to/save/file') - .on('state_changed', snapshot => { - //Current download state - }, err => { - //Error - unsubscribe(); - }, downloadedFile => { - //Success - unsubscribe(); - }); +.ref('/files/1234') +.downloadFile('/path/to/save/file') +.on('state_changed', snapshot => { +//Current download state +}, err => { +//Error +unsubscribe(); +}, downloadedFile => { +//Success +unsubscribe(); +}); ``` ## TODO