Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the event-emitter Reference Manual, version 0.0.1, generated automatically by Declt version 3.0 "Montgomery Scott" on Sun May 15 04:42:23 2022 GMT+0.
• Introduction | What event-emitter is all about | |
• Systems | The systems documentation | |
• Files | The files documentation | |
• Packages | The packages documentation | |
• Definitions | The symbols documentation | |
• Indexes | Concepts, functions, variables and data types |
Event Emitter provides an event mechanism like Node.js for Common Lisp objects.
Mostly ported from Node.js 'events' module.
;; Defining Event Emitter class.
(defclass person (event-emitter)
((name :initarg :name
:reader name)))
(defvar *user*
(make-instance 'person :name "Eitaro Fukamachi"))
;; Attach a event listener for an event ':say-hi'.
(on :say-hi *user*
(lambda () (format t "Hi!")))
;; *user* says 'Hi!' when an event ':say-hi' is invoked.
(emit :say-hi *user*)
;-> Hi!
(emit :say-hi *user*)
;-> Hi!
(emit :say-hi *user*)
;-> Hi!
;; Attach an one time event listener.
(once :say-hi *user*
(lambda ()
(format t "How's it going?")))
;; 'Hi!' and "How's it going?" will be printed.
(emit :say-hi *user*)
;-> Hi!
; How's it going?
;; *user* doens't say "How's it going?" anymore.
(emit :say-hi *user*)
;-> Hi!
(emit :say-hi *user*)
;-> Hi!
There's already similar library named event-glue which you may like to know.
Base standard class for 'event-emitter's.
(defclass person (event-emitter)
((name :initarg :name)))
Base strucuture class for 'event-emitter's.
(defstruct (person :include event-emitter*)
name)
Adds a listener to the end of the listeners array for the specified event.
(on :connection server
(lambda (stream) ...))
NOTE: add-listener
and on
takes 'object' and 'event' the opposite order.
Adds a one time listener for the event. This listener is invoked only the next time the event is fired, after which it is removed.
(once :connection server
(lambda (stream) ...))
Removes a listener from the listener array for the specified event.
(defun connection-cb (stream)
...)
(on :connection server #'connection-cb)
(remove-listener server :connection #'connection-cb)
Removes all listeners, or those of the specified event.
(remove-all-listeners server)
(remove-all-listeners server :connection)
Returns an array of listeners for the specified event.
Executes each of the listeners in order with the supplied arguments.
Returns T
if the event had listeners, NIL
otherwise.
Returns the number of listeners for a given event.
Copyright (c) 2014 Eitaro Fukamachi (e.arrows@gmail.com)
Licensed under the BSD 2-Clause License.
Next: Files, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The event-emitter system |
Eitaro Fukamachi
BSD 2-Clause
Event mechanism for Common Lisp objects
0.0.1
event-emitter.asd (file)
src/event-emitter.lisp (file)
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files |
• The event-emitter.asd file | ||
• The event-emitter/src/event-emitter.lisp file |
Next: The event-emitter/src/event-emitter․lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
event-emitter.asd
event-emitter (system)
Previous: The event-emitter․asd file, Up: Lisp files [Contents][Index]
event-emitter (system)
src/event-emitter.lisp
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
• The event-emitter-asd package | ||
• The event-emitter package |
Next: The event-emitter package, Previous: Packages, Up: Packages [Contents][Index]
event-emitter.asd
Previous: The event-emitter-asd package, Up: Packages [Contents][Index]
src/event-emitter.lisp (file)
common-lisp
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions | ||
• Internal definitions |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported functions | ||
• Exported structures | ||
• Exported classes |
Next: Exported structures, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
src/event-emitter.lisp (file)
src/event-emitter.lisp (file)
src/event-emitter.lisp (file)
src/event-emitter.lisp (file)
src/event-emitter.lisp (file)
src/event-emitter.lisp (file)
src/event-emitter.lisp (file)
src/event-emitter.lisp (file)
Next: Exported classes, Previous: Exported functions, Up: Exported definitions [Contents][Index]
src/event-emitter.lisp (file)
structure-object (structure)
(make-hash-table :test (quote eq))
event-emitter*-silo (function)
(setf event-emitter*-silo) (function)
Previous: Exported structures, Up: Exported definitions [Contents][Index]
src/event-emitter.lisp (file)
standard-object (class)
(make-hash-table :test (quote eq))
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal functions | ||
• Internal structures |
Next: Internal structures, Previous: Internal definitions, Up: Internal definitions [Contents][Index]
src/event-emitter.lisp (file)
src/event-emitter.lisp (file)
src/event-emitter.lisp (file)
src/event-emitter.lisp (file)
src/event-emitter.lisp (file)
src/event-emitter.lisp (file)
src/event-emitter.lisp (file)
src/event-emitter.lisp (file)
src/event-emitter.lisp (file)
src/event-emitter.lisp (file)
src/event-emitter.lisp (file)
Previous: Internal functions, Up: Internal definitions [Contents][Index]
src/event-emitter.lisp (file)
structure-object (structure)
listener-function (function)
(setf listener-function) (function)
listener-once (function)
(setf listener-once) (function)
Previous: Definitions, Up: Top [Contents][Index]
• Concept index | ||
• Function index | ||
• Variable index | ||
• Data type index |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | E F L |
---|
Jump to: | E F L |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Jump to: | %
(
A C E F L M O R S |
---|
Jump to: | %
(
A C E F L M O R S |
---|
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
Jump to: | F O S |
---|
Jump to: | F O S |
---|
Previous: Variable index, Up: Indexes [Contents][Index]
Jump to: | C E L P S |
---|
Jump to: | C E L P S |
---|