Skip to content
This repository was archived by the owner on Jul 2, 2021. It is now read-only.
This repository was archived by the owner on Jul 2, 2021. It is now read-only.

Add some check on EmitterSubscription's listener #25

@em-yuanbo

Description

@em-yuanbo

https://github.com/facebook/emitter/blob/master/src/EmitterSubscription.js#L32
there is no validation on the param listener

  constructor(subscriber: EventSubscriptionVendor, listener, context: ?Object) {
    super(subscriber);
    this.listener = listener;
    this.context = context;
  }

and no appliable check when apply the listener.
https://github.com/facebook/emitter/blob/master/src/BaseEventEmitter.js#L182

  __emitToSubscription(subscription, eventType) {
    var args = Array.prototype.slice.call(arguments, 2);
    subscription.listener.apply(subscription.context, args);
  }

can we add some checks or make some noises when create a new EmitterSubscription?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions