Closed Bug 1637561 Opened 5 years ago Closed 5 years ago

Use dictionary argument in ResourceWatcher.watch

Categories

(DevTools :: Framework, enhancement)

enhancement

Tracking

(Fission Milestone:M7, firefox78 fixed)

RESOLVED FIXED
Firefox 78
Fission Milestone M7
Tracking Status
firefox78 --- fixed

People

(Reporter: ochameau, Assigned: daisuke)

Details

(Whiteboard: dt-fission-m2-mvp)

Attachments

(1 file)

ResourceWatcher.watch interface looks currently like this:
async watch(resources, onAvailable, onDestroyed) {

But, we are talking about exposing a new onUpdated callback (here), and also possibly a new option in order to listen only for "future" resources (here). And who knows if we will start adding yet some others??

It may be great to start using a dictionary argument.

I could think about using either:
async watch(resources, { onAvailable, onDestroyed })
or
async watch({ resources, onAvailable, onDestroyed })
The first better highlight that resources is a mandatory attribute.

This may soon become:
async watch(resources, { onAvailable, onUpdated, onDestroyed, onlyFuture })
or
async watch({ resources, onAvailable, onUpdated, onDestroyed, onlyFuture })

(Flagging in the reserve list as that's not mandarory refactoring)

I like the async watch(resources, { onAvailable, onDestroyed }) option. As you said, it highlights the importance and mandatory nature of resources. onAvailable is also mandatory, but async watch(resources, onAvailable, { onDestroyed, ... }) would not make any sense :)

dt-fission-m2-reserve bugs do not need to block Fission Nightly (M6). For now, let's track them for Fission riding the trains to Beta (M7) so we revisit these bugs before we ship Fission.

Fission Milestone: --- → M7
Assignee: nobody → daisuke
Status: NEW → ASSIGNED

agreed with Comment 2 :)

Okee! And me too!

Whiteboard: dt-fission-m2-reserve → dt-fission-m2-mvp
Pushed by dakatsuka.birchill@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/71f30ecda0be Introduce dictionary argument to 'watch' function. r=ochameau,nchevobbe
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 78
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: