Re: [whatwg/dom] Improving ergonomics of events with Observable (#544)

In web APIs, per the rules of [Web IDL](https://heycam.github.io/webidl/), it's not possible to distinguish between a function and a dictionary. (Since functions can have properties too.) So it's just disallowed in all web specs currently. Figuring out how or whether to allow both `o.subscribe(fn)` and `o.subscribe({ next })` is the TODO.

To be clear, the tricky case is

```js
function fn() { console.log("1"); }
fn.next = () => { console.log("2") };

o.subscribe(fn);
```

Which does this call? Sure, we could make a decision one way or another, but so far in web APIs the decision has been to just disallow this case from ever occurring by not allowing specs that have such overloads, So whatever we do here will need to be a bit novel.

This is all a relatively minor point though, IMO. Perhaps we should move it to https://github.com/heycam/webidl/issues.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/544#issuecomment-351453286

Received on Wednesday, 13 December 2017 16:57:06 UTC