All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.reactors.debugger.js.event-stream.js Maven / Gradle / Ivy

"use-strict";


class EventStream {
  constructor() {
    this.uidCount = 0;
    this.observers = {};
  }

  observe(f) {
    var uid = this.uidCount++;
    this.observers[uid] = f;
    return () => {
      delete this.observers[uid];
    }
  }

  post() {
    for (var uid in this.observers) {
      var f = this.observers[uid];
      f.apply(this, arguments);
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy