Skip to content

Don't expose send #3

@Raynos

Description

@Raynos

Having a public send leads to the annoyance of anything that can watch an event can send data.

The way to get around this is to only give access to the send function to the creater of the event.

A way to do so API wise is to change event

function event(callback) {
  var ev = new Event()

  callback(function (data) {
    send(ev, data)
  })

  return ev
}

event(function (next) {
    elem.addEventListener("click", next)
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions