Browse code
feat(store): add a recording store for viewing action history
Ed Langley authored on 23/12/2019 21:00:34
Showing 1 changed files
Showing 1 changed files
... | ... |
@@ -3,7 +3,9 @@ |
3 | 3 |
(:export #:store #:execute #:dispatch |
4 | 4 |
#:next-store |
5 | 5 |
#:next-store-p |
6 |
- #:propagate)) |
|
6 |
+ #:propagate |
|
7 |
+ #:recording-store |
|
8 |
+ #:record)) |
|
7 | 9 |
(in-package :mfa-tool.store) |
8 | 10 |
|
9 | 11 |
(defclass store () |
... | ... |
@@ -11,6 +13,9 @@ |
11 | 13 |
(defun next-store-p (store) |
12 | 14 |
(slot-boundp store '%next-store)) |
13 | 15 |
|
16 |
+(fw.lu:defclass+ recording-store () |
|
17 |
+ ((%record :reader record :accessor %record :initform ()))) |
|
18 |
+ |
|
14 | 19 |
(defgeneric execute (store action) |
15 | 20 |
(:argument-precedence-order action store) |
16 | 21 |
(:method :around (store action) |
... | ... |
@@ -31,3 +36,7 @@ |
31 | 36 |
(dispatch (next-store store) |
32 | 37 |
action)) |
33 | 38 |
store) |
39 |
+ |
|
40 |
+(defmethod dispatch :before ((store recording-store) action) |
|
41 |
+ (push action |
|
42 |
+ (%record store))) |