Gozala / Gozala/event

Don't expose `send`

Open
#3 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3
Forks
2
PR merge metrics
No merged PRs in 30d

Description

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)
})
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.