/
MvcExpress.as
90 lines (76 loc) · 2.88 KB
/
MvcExpress.as
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
package mvcexpress {
import mvcexpress.core.namespace.pureLegsCore;
import mvcexpress.core.traceObjects.TraceObj;
/**
* Class to store framework global settings and some important variables.
* @author Raimundas Banevicius (http://mvcexpress.org/)
*
* @version 2.0.rc1
*/
public class MvcExpress {
/** Home website of mvcExpress. */
public static const WEBSITE_URL:String = "http://mvcExpress.org";
/** Framework name */
public static const NAME:String = "mvcExpress 2 RC3";
/** Current framework major version */
public static const MAJOR_VERSION:uint = 2;
/** Current framework minor version */
public static const MINOR_VERSION:uint = 0;
/** Current framework revision version */
public static const REVISION:uint = 3;
/** Current framework version */
public static const VERSION:String = "v" + MAJOR_VERSION + "." + MINOR_VERSION + "." + REVISION;
/**
* Checks for CONFIG::debug variable value.
* If it is true framework functions has overhead code, this overhead is used for debugging and error checking.
* This value can help not to forget compile with CONFIG::debug set to false for release.
*/
public static function get DEBUG_COMPILE():Boolean {
CONFIG::debug {
return true;
}
return false;
}
/**
* Time in ms for framework to wait for missing dependencies.
* By default pending dependency feature is disabled, as it is set to 0. If missing injection is encountered - error will be instantly thrown.
* If pendingInjectsTimeOut is > 0, framework will wait this amount of time in milliseconds for missing dependencies to be mapped.
* If dependency is mapped during this waiting time - framework will find missing dependencies and resolve them.
* If in this time dependencies will not be resolved - error will be thrown.
*/
public static var pendingInjectsTimeOut:uint = 0;
/**
* Sets a debug function that will get framework activity constants as String's.
* CONFIG:debug MUST be set to true for debugFunction to get any trace data from framework.
* For example you can use : MvcExpress.debugFunction = trace; to trace all debug data.
* it is good idea to set it before initializing first module.
*/
static public var debugFunction:Function = null;
//----------------------------------
// Internal
//----------------------------------
/**
* Function to get more detailed framework activity information as TraceObj objects.
* @private
*/
static pureLegsCore var loggerFunction:Function = null;
/**
* Framework function for debugging.
* @param traceObj
* @private
*/
CONFIG::debug
static pureLegsCore function debug(traceObj:TraceObj):void {
use namespace pureLegsCore;
if (debugFunction != null) {
if (traceObj.canPrint) {
debugFunction(traceObj.toString());
}
}
if (loggerFunction != null) {
loggerFunction(traceObj);
}
}
}
}