forked from supnate/dojos
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Site.js
59 lines (50 loc) · 1.22 KB
/
Site.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
59
define([
'dojo/_base/declare'
,'dojo/_base/lang'
,'./Server'
], function(declare, lang, Server){
// summary:
// Represent a web site which contains a dojos/Server instance.
// Site object also provides all site related information.
return declare(null, {
//id:
// Dojo AMD package name of the site
id: ''
//name:
// Display name of the site
,name: ''
//location:
// Root folder of the site
,location: ''
//status:
// Site status: Running, Stopped
,status: ''
//port:
// The listening port of the web site
,port: 1337
//server:
// The dojos/Server instance running the site
,server: null
,constructor: function(args){
lang.mixin(this, args);
}
,start: function(){
// summary:
// Start the site by starting a dojos/Server instance to listen on given port
if(!this.server)this.server = new Server({
id: this.id
,location: this.location
,port: this.port
});
!this.server.started && this.server.start();
this.status = 'Running';
}
,stop: function(){
// summary:
// Stop the site by stopping the dojos/Server instance
if(!this.server)return;
this.server.started && this.server.stop();
this.status = 'Stopped';
}
});
});