18
18
* limitations under the License.
19
19
*/
20
20
21
- /**
21
+ /*
22
22
* This module manages the behaviors of all components.
23
23
* A behavior is a mecanism that allow users to add actions that will be executed
24
24
* when a specific state of a component will change.
@@ -61,7 +61,7 @@ var store = {};
61
61
* @return {Function } the created function
62
62
* @private
63
63
*/
64
- function createFunction ( name , func , core , useCoreAPI ) {
64
+ function createFunction ( name , func , core , useCoreAPI ) {
65
65
var beginBody = - 1 ,
66
66
funcParams = '' ,
67
67
params = [ ] ,
@@ -147,7 +147,7 @@ function createFunction (name, func, core, useCoreAPI) {
147
147
/* Public methods */
148
148
149
149
150
- /*
150
+ /**
151
151
* Add a behavior that will be stored in System Runtime database.
152
152
* @method add
153
153
* @param {String } id id of the component
@@ -157,7 +157,7 @@ function createFunction (name, func, core, useCoreAPI) {
157
157
* @param {Boolean } core if true, behavior can not be exported
158
158
* @return {String } id of the behavior created in System Runtime database
159
159
*/
160
- function add ( id , state , action , useCoreAPI , core ) {
160
+ exports . add = function add ( id , state , action , useCoreAPI , core ) {
161
161
var behaviorId = $helper . generateId ( ) ,
162
162
strAction = action . toString ( ) ;
163
163
@@ -182,10 +182,10 @@ function add (id, state, action, useCoreAPI, core) {
182
182
} ) ;
183
183
184
184
return behaviorId ;
185
- }
185
+ } ;
186
186
187
187
188
- /*
188
+ /**
189
189
* Remove a behavior with its id or remove all the behaviors for a specific state
190
190
* of the component.
191
191
* @method remove
@@ -194,7 +194,7 @@ function add (id, state, action, useCoreAPI, core) {
194
194
* {String} state state of the component <br>
195
195
* {String} behaviorId id of the behavior (optional)) <br>
196
196
*/
197
- function remove ( params ) {
197
+ exports . remove = function remove ( params ) {
198
198
var result = [ ] ;
199
199
200
200
params = params || { } ;
@@ -226,27 +226,27 @@ function remove (params) {
226
226
} ) ;
227
227
}
228
228
}
229
- }
229
+ } ;
230
230
231
231
232
- /*
232
+ /**
233
233
* Remove a behavior with its id from the memory.
234
234
* @method removeFromMemory
235
235
* @param {String } id id of the component
236
236
*/
237
- function removeFromMemory ( id ) {
237
+ exports . removeFromMemory = function removeFromMemory ( id ) {
238
238
delete store [ id ] ;
239
- }
239
+ } ;
240
240
241
241
242
- /*
242
+ /**
243
243
* Get all the actions of a behavior for a component.
244
244
* @method getActions
245
245
* @param {String } id id of the component
246
246
* @param {String } state name of the state
247
247
* @return {Array } all the actions that have to be executed for a specific component and state
248
248
*/
249
- function getActions ( id , state ) {
249
+ exports . getActions = function getActions ( id , state ) {
250
250
var result = [ ] ,
251
251
dbResult = [ ] ,
252
252
action = null ;
@@ -269,56 +269,16 @@ function getActions (id, state) {
269
269
} ) ;
270
270
271
271
return result ;
272
- }
272
+ } ;
273
273
274
274
275
- /*
275
+ /**
276
276
* Remove all the behaviors stored in memory.
277
277
* @method clear
278
278
*/
279
- function clear ( ) {
279
+ exports . clear = function clear ( ) {
280
280
store = { } ;
281
- }
282
-
283
-
284
- /*
285
- * Get a behavior by its id.
286
- * @method get
287
- * @param {String } id id of the behavior
288
- * @return {Behavior } the behavior
289
- */
290
- function get ( id ) {
291
- return store [ id ] ;
292
- }
293
-
294
-
295
- /* exports */
296
-
297
-
298
- /**
299
- * This module manages the behaviors of all components. A behavior is a mecanism that allow users to add action that will be executed
300
- * when a specific state of a component will change.
301
- *
302
- * @module behavior
303
- * @requires db
304
- * @requires helper
305
- * @requires channel
306
- * @class behavior
307
- * @static
308
- */
309
-
310
-
311
- /**
312
- * Add a behavior that will be stored in System Runtime database.
313
- * @method add
314
- * @param {String } id id of the component
315
- * @param {Object } state the state on which the action will be executed
316
- * @param {Object } action the action to execute when the component will have a specific state
317
- * @param {Boolean } useCoreAPI if true, System Runtime core modules will be injected as parameters of the action (default false)
318
- * @param {Boolean } core if true, behavior can not be exported
319
- * @return {String } id of the behavior created in System Runtime database
320
- */
321
- exports . add = add ;
281
+ } ;
322
282
323
283
324
284
/**
@@ -327,41 +287,6 @@ exports.add = add;
327
287
* @param {String } id id of the behavior
328
288
* @return {Behavior } the behavior
329
289
*/
330
- exports . get = get ;
331
-
332
-
333
- /**
334
- * Remove a behavior with its id or remove all the behaviors for a specific state
335
- * of the component.
336
- * @method remove
337
- * @param {Object } params <br>
338
- * {String} componentId id of the component <br>
339
- * {String} state state of the component <br>
340
- * {String} behaviorId id of the behavior (optional)) <br>
341
- */
342
- exports . remove = remove ;
343
-
344
-
345
- /**
346
- * Get all the actions of a behavior for a component.
347
- * @method getActions
348
- * @param {String } id id of the component
349
- * @param {String } state name of the state
350
- * @return {Array } all the actions that have to be executed for a specific component and state
351
- */
352
- exports . getActions = getActions ;
353
-
354
-
355
- /**
356
- * Remove all the behaviors stored in memory.
357
- * @method clear
358
- */
359
- exports . clear = clear ;
360
-
361
-
362
- /**
363
- * Remove a behavior with its id from the memory.
364
- * @method removeFromMemory
365
- * @param {String } id id of the component
366
- */
367
- exports . removeFromMemory = removeFromMemory ;
290
+ exports . get = function get ( id ) {
291
+ return store [ id ] ;
292
+ } ;
0 commit comments