firebase / firebase/firebase-js-sdk

UploadTask Example 3 broken

Open
#7,859 0 comments 0 reactions 0 assignees View on GitHub
api: storage documentation needs-attention question
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

### Operating System

macOS

### Browser Version

Safari 16.5.2

### Firebase SDK Version

10.7.0

### Firebase SDK Product:

Storage

### Describe your project's tooling

index.html with source tag. Just javascript.

### Describe the problem

[Example 3](https://firebase.google.com/docs/reference/js/storage.uploadtask.md#example_3) is partly broken.

### Steps and code to reproduce issue

This snippet is broken

```
var handle = uploadTask.on('state_changed');//changed from firebase.storage.TaskEvent.STATE_CHANGED
unsubscribe = handle(function(snapshot) {
var percent = snapshot.bytesTransferred / snapshot.totalBytes * 100;
console.log(percent + "% done");
// Stop after receiving one update.
unsubscribe();
});
```

It does not work. I get the error `undefined is not an object (evaluating 't.next')`. It seems that the `on` method can only return Unsubscribe.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.