Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package;
- class Event<T>
- {
- private var _list:Array<T>;
- public function new()
- {
- _list = [];
- }
- public function addListener(f:T) {
- if (_list.indexOf(f) > -1) return;
- _list.push(f);
- }
- public function removeListener(f:T) {
- _list.remove(f);
- }
- public function dispatch(f:Array<T>->Void) {
- if (f != null) f(_list);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement