Ticket #51 (new task)
Opened 20 months ago
Should iochannel have on* callbacks?
| Reported by: | scott | Owned by: | gt3 |
|---|---|---|---|
| Priority: | major | Milestone: | Sagot 0.1 |
| Component: | IMGV | Version: | |
| Keywords: | Cc: |
Description
Research Task
It may be worthwhile to look into making iochannel's have a onread, onwrite, onclose, onerror type of events. These events would probably only be available after, though, an iochannel has been associated with an eventloop. This would create a syntax such as:
var loop = new EventLoop()
loop.watch(iochannel)
iochannel.onread = function () {
print(this.read())
}
iochannel.onwrite = function () {
this.write(pending_data.shift())
}
iochannel.onerror = function (error) {
print(this + " closed, due to " + error)
}
/* etc... */
It promotes scope hacks, but that's ok because that promotes privacy. This also may be less work to code up than introducing the entire glib event source API, source objects, and so on.
Note: See
TracTickets for help on using
tickets.