-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzonegrid.js
58 lines (46 loc) · 1.52 KB
/
zonegrid.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* NODE MODULES */
var eventerface = require('eventerface'),
zone = require('./zone'),
defaults = require('./defaults');
/** LOCAL OBJECT
* @property {} -
*/
var ZONEGRID = {
};
/** MODULE INTERFACE
*@method {function} createZone - Creates a zone object after validating the specified properties
*@method {function} createGrid - Creates a grid object after validating the specified properties
*/
module.exports = {
createZone: createZone,
createGrid: createGrid
};
/*----------------------------------------------------------------------------*/
/** Creates a zone object after validating the specified properties
* @param {object} properties - The properties of the zone to be created
* @returns {object} newZone - The created zone object
*/
function createZone(properties) {
var defaultProperties = defaults.zoneProperties(),
newZone;
if (typeof properties !== 'object') {
properties = defaultProperties;
}
else {
// Validate parameters
}
// Create a global namespace for event-based communication between the zone modules
eventerface.create('zone_' + properties.id);
// Create the zone
newZone = zone.create(properties);
return newZone;
}
/** Creates a grid object after validating the specified properties
* @param {object} properties - The properties of the grid to be created
* @returns {object} newGrid - The created grid object
*/
function createGrid(properties) {
var newGrid;
newGrid = grid.create(properties);
return newGrid;
}