mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-04 22:56:45 +08:00
39 lines
853 B
TypeScript
39 lines
853 B
TypeScript
import '@react-native-firebase/storage';
|
|
import '@react-native-firebase/perf';
|
|
import '@react-native-firebase/functions';
|
|
|
|
import { firebase } from '@react-native-firebase/analytics';
|
|
|
|
const foo = async () => {
|
|
const task = firebase
|
|
.app()
|
|
.storage('gs://foo')
|
|
.ref('foo')
|
|
.putFile('');
|
|
|
|
task.finally
|
|
|
|
task.on(firebase.storage.TaskEvent.STATE_CHANGED, taskSnapshot => {
|
|
if (taskSnapshot.state === firebase.storage.TaskState.) {
|
|
console.log('cancelling task!');
|
|
taskSnapshot.task.cancel();
|
|
}
|
|
});
|
|
|
|
task.catch(e => {
|
|
return 'bar';
|
|
});
|
|
|
|
task.then(snapshot => {
|
|
snapshot.metadata.bucket;
|
|
return 'foo';
|
|
});
|
|
|
|
firebase.storage.TaskState.CANCELLED;
|
|
firebase.storage.TaskEvent.STATE_CHANGED;
|
|
firebase.perf().newHttpMetric('', 'GET');
|
|
// firebase.functions.HttpsErrorCode.ABORTED;
|
|
};
|
|
|
|
foo();
|