UNPKG

4.11 kBPlain TextView Raw
1import createDebug from 'debug';
2import Reflux from 'reflux';
3const debug = createDebug('hadron-app-registry:actions');
4
5/**
6 * The action for an action being deregistered.
7 */
8const actionDeregistered = Reflux.createAction({
9 /**
10 * Log the action.
11 *
12 * @param {String} name - The action name.
13 */
14 preEmit: function (name: string) {
15 debug(`Action ${name} deregistered.`);
16 },
17});
18
19/**
20 * The action for an action being registered.
21 */
22const actionRegistered = Reflux.createAction({
23 /**
24 * Log the action.
25 *
26 * @param {String} name - The action name.
27 */
28 preEmit: function (name: string) {
29 debug(`Action ${name} registered.`);
30 },
31});
32
33/**
34 * The action for an action being overridden.
35 */
36const actionOverridden = Reflux.createAction({
37 /**
38 * Log the action.
39 *
40 * @param {String} name - The action name.
41 */
42 preEmit: function (name: string) {
43 debug(`Action ${name} overwrote existing action in the registry.`);
44 },
45});
46
47/**
48 * The action for a component being deregistered.
49 */
50const componentDeregistered = Reflux.createAction({
51 /**
52 * Log the action.
53 *
54 * @param {String} name - The component name.
55 */
56 preEmit: function (name: string) {
57 debug(`Component ${name} deregistered.`);
58 },
59});
60
61/**
62 * The action for a component being registered.
63 */
64const componentRegistered = Reflux.createAction({
65 /**
66 * Log the action.
67 *
68 * @param {String} name - The component name.
69 */
70 preEmit: function (name: string) {
71 debug(`Component ${name} registered.`);
72 },
73});
74
75/**
76 * The action for a container being deregistered.
77 */
78const containerDeregistered = Reflux.createAction({
79 /**
80 * Log the action.
81 *
82 * @param {String} name - The container name.
83 */
84 preEmit: function (name: string) {
85 debug(`Container ${name} deregistered.`);
86 },
87});
88
89/**
90 * The action for a container being registered.
91 */
92const containerRegistered = Reflux.createAction({
93 /**
94 * Log the action.
95 *
96 * @param {String} name - The container name.
97 */
98 preEmit: function (name: string) {
99 debug(`Container ${name} registered.`);
100 },
101});
102
103/**
104 * The action for a component being overridden.
105 */
106const componentOverridden = Reflux.createAction({
107 /**
108 * Log the action.
109 *
110 * @param {String} name - The component name.
111 */
112 preEmit: function (name: string) {
113 debug(`Component ${name} overwrote existing component in the registry.`);
114 },
115});
116
117/**
118 * The action for a role being deregistered.
119 */
120const roleDeregistered = Reflux.createAction({
121 /**
122 * Log the action.
123 *
124 * @param {String} name - The role name.
125 */
126 preEmit: function (name: string) {
127 debug(`Role ${name} deregistered.`);
128 },
129});
130
131/**
132 * The action for a role being registered.
133 */
134const roleRegistered = Reflux.createAction({
135 /**
136 * Log the action.
137 *
138 * @param {String} name - The role name.
139 */
140 preEmit: function (name: string) {
141 debug(`Role ${name} registered.`);
142 },
143});
144
145/**
146 * The action for a store being deregistered.
147 */
148const storeDeregistered = Reflux.createAction({
149 /**
150 * Log the action.
151 *
152 * @param {String} name - The store name.
153 */
154 preEmit: function (name: string) {
155 debug(`Store ${name} deregistered.`);
156 },
157});
158
159/**
160 * The action for a store being registered.
161 */
162const storeRegistered = Reflux.createAction({
163 /**
164 * Log the action.
165 *
166 * @param {String} name - The store name.
167 */
168 preEmit: function (name: string) {
169 debug(`Store ${name} registered.`);
170 },
171});
172
173/**
174 * The action for a store being overridden.
175 */
176const storeOverridden = Reflux.createAction({
177 /**
178 * Log the action.
179 *
180 * @param {String} name - The store name.
181 */
182 preEmit: function (name: string) {
183 debug(`Store ${name} overwrote existing store in the registry.`);
184 },
185});
186
187export const Actions = {
188 actionDeregistered,
189 actionRegistered,
190 actionOverridden,
191 componentDeregistered,
192 componentRegistered,
193 componentOverridden,
194 containerDeregistered,
195 containerRegistered,
196 roleDeregistered,
197 roleRegistered,
198 storeDeregistered,
199 storeRegistered,
200 storeOverridden,
201};