UNPKG

3.1 kBJavaScriptView Raw
1'use strict';
2
3const debug = require('debug')('hadron-app-registry:actions');
4const Reflux = require('reflux');
5
6/**
7 * The action for an action being deregistered.
8 */
9const actionDeregistered = Reflux.createAction({
10
11 /**
12 * Log the action.
13 *
14 * @param {String} name - The action name.
15 */
16 preEmit: function(name) {
17 debug(`Action ${name} deregistered.`);
18 }
19});
20
21/**
22 * The action for an action being registered.
23 */
24const actionRegistered = Reflux.createAction({
25 /**
26 * Log the action.
27 *
28 * @param {String} name - The action name.
29 */
30 preEmit: function(name) {
31 debug(`Action ${name} registered.`);
32 }
33});
34
35/**
36 * The action for an action being overridden.
37 */
38const actionOverridden = Reflux.createAction({
39 /**
40 * Log the action.
41 *
42 * @param {String} name - The action name.
43 */
44 preEmit: function(name) {
45 debug(`Action ${name} overwrote existing action in the registry.`);
46 }
47});
48
49/**
50 * The action for a component being deregistered.
51 */
52const componentDeregistered = Reflux.createAction({
53
54 /**
55 * Log the action.
56 *
57 * @param {String} name - The component name.
58 */
59 preEmit: function(name) {
60 debug(`Component ${name} deregistered.`);
61 }
62});
63
64/**
65 * The action for a component being registered.
66 */
67const componentRegistered = Reflux.createAction({
68 /**
69 * Log the action.
70 *
71 * @param {String} name - The component name.
72 */
73 preEmit: function(name) {
74 debug(`Component ${name} registered.`);
75 }
76});
77
78/**
79 * The action for a component being overridden.
80 */
81const componentOverridden = Reflux.createAction({
82 /**
83 * Log the action.
84 *
85 * @param {String} name - The component name.
86 */
87 preEmit: function(name) {
88 debug(`Component ${name} overwrote existing component in the registry.`);
89 }
90});
91
92/**
93 * The action for a store being deregistered.
94 */
95const storeDeregistered = Reflux.createAction({
96
97 /**
98 * Log the action.
99 *
100 * @param {String} name - The store name.
101 */
102 preEmit: function(name) {
103 debug(`Store ${name} deregistered.`);
104 }
105});
106
107/**
108 * The action for a store being registered.
109 */
110const storeRegistered = Reflux.createAction({
111 /**
112 * Log the action.
113 *
114 * @param {String} name - The store name.
115 */
116 preEmit: function(name) {
117 debug(`Store ${name} registered.`);
118 }
119});
120
121/**
122 * The action for a store being overridden.
123 */
124const storeOverridden = Reflux.createAction({
125 /**
126 * Log the action.
127 *
128 * @param {String} name - The store name.
129 */
130 preEmit: function(name) {
131 debug(`Store ${name} overwrote existing store in the registry.`);
132 }
133});
134
135module.exports.actionDeregistered = actionDeregistered;
136module.exports.actionRegistered = actionRegistered;
137module.exports.actionOverridden = actionOverridden;
138module.exports.componentDeregistered = componentDeregistered;
139module.exports.componentRegistered = componentRegistered;
140module.exports.componentOverridden = componentOverridden;
141module.exports.storeDeregistered = storeDeregistered;
142module.exports.storeRegistered = storeRegistered;
143module.exports.storeOverridden = storeOverridden;