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

Agent should extend EventEmitter #175

Merged
merged 1 commit into from
Feb 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions app/current/src/main/scala/io/scalajs/nodejs/http/Agent.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.scalajs.nodejs
package http

import io.scalajs.nodejs.events.IEventEmitter
import io.scalajs.util.PromiseHelper._

import scala.concurrent.Future
Expand All @@ -16,16 +17,11 @@ import scala.scalajs.js.annotation.JSImport
*/
@js.native
@JSImport("http", "Agent")
class Agent(options: AgentOptions = js.native) extends js.Object {
class Agent(options: AgentOptions = js.native) extends IEventEmitter {
/////////////////////////////////////////////////////////////////////////////////
// Properties
/////////////////////////////////////////////////////////////////////////////////

/**
* The agent's domain name
*/
def domain: String = js.native

/**
* An object which contains arrays of sockets currently awaiting use by the Agent when HTTP KeepAlive is used. Do not modify.
* @example agent.freeSockets
Expand Down Expand Up @@ -112,5 +108,7 @@ object Agent {
def createConnectionFuture(options: ConnectionOptions): Future[js.Any] = {
promiseWithError1[Error, js.Any](agent.createConnection(options, _))
}

@inline def onKeylog(handler: () => Any): agent.type = agent.on("keylog", handler)
}
}