Make api-utils/observer-service consistent with other event APIs

RESOLVED FIXED

Status

Add-on SDK
General
P2
normal
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: irakli, Assigned: irakli)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

At the moment observer-service module provides same API as any other event emitter with a difference that it does not implements event emitter API. We must make it consistent other event emitters to lower the cost of maintenance and learning curve:

https://github.com/mozilla/addon-sdk/blob/master/packages/api-utils/lib/observer-service.js
There is a very subtle difference with this `target` object, right?

Again, I'm not against this improvement. I just have the same feeling than bug 724625. Even if it is an api-utils library, it may already be used by many addons.
And breaking APIs seems to go against Jetpack promises.
So even if we try to shout loud that low level API aren't frozen,
I'd really like to see deprecation for multiple releases before removal.

Otherwise, I'm really up for it!! 
Your overall goal to use common patterns can have a big impact of jetpack simplicity.
(In reply to Alexandre Poirot (:ochameau) from comment #1)
> There is a very subtle difference with this `target` object, right?

No need for target, there is Function.prototype.bind.
 

> Again, I'm not against this improvement. I just have the same feeling than
> bug 724625. Even if it is an api-utils library, it may already be used by
> many addons.
> And breaking APIs seems to go against Jetpack promises.
> So even if we try to shout loud that low level API aren't frozen,
> I'd really like to see deprecation for multiple releases before removal.
> 
> Otherwise, I'm really up for it!! 
> Your overall goal to use common patterns can have a big impact of jetpack
> simplicity.

I totally agree we'll implement it as an alternative module and make observer-service use it with a deprecation warnings.
Assignee: nobody → rFobic
Priority: -- → P2
Fixed by https://github.com/mozilla/addon-sdk/commit/d292d75edf1a6aa747bb531b9a72033889566f21
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.