1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | function Instance () {
|
18 | this.id = 'generic-' + Math.floor(Math.random() * 1000);
|
19 | this.starttime = new Date();
|
20 | this.endtime = null;
|
21 | }
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | var include = require('./include.js');
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 | Instance.prototype.end = function(error, data) {};
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 | Instance.prototype.echo = function(data) {};
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 | Instance.prototype.error = function(data) {};
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 | Instance.prototype.controller = function(path) {
|
52 | return include(
|
53 | this.kernel.appdir
|
54 | + this.kernel.config._KERNEL_DIR_CONTROLLERS + '/'
|
55 | + path
|
56 | ,this ,this.kernel
|
57 | );
|
58 | };
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 | Instance.prototype.interval = function(path) {
|
66 | return include(
|
67 | this.kernel.appdir
|
68 | + this.kernel.config._KERNEL_DIR_INTERVALS + '/'
|
69 | + path
|
70 | ,this ,this.kernel
|
71 | );
|
72 | };
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 | Instance.prototype.model = function(path) {
|
80 | return include.call(this,
|
81 | this.kernel.appdir
|
82 | + this.kernel.config._KERNEL_DIR_MODELS + '/'
|
83 | + path
|
84 | ,this ,this.kernel
|
85 | );
|
86 | };
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 | Instance.prototype.view = function(path, vars) {
|
95 | var view = this.kernel.include(
|
96 | this.kernel.kerneldir + 'instance/view'
|
97 | ).new();
|
98 | path = this.kernel.appdir + 'views/' + path;
|
99 | if (!vars) {
|
100 | return view.load(path);
|
101 | } else {
|
102 | view.load(path);
|
103 | return view.parse(vars);
|
104 | }
|
105 | };
|
106 |
|
107 |
|
108 |
|
109 |
|
110 | exports = module.exports = Instance; |
\ | No newline at end of file |