-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
expose.js
58 lines (52 loc) · 1.24 KB
/
expose.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
/*
Expose Internal API
把 Expose 部分放在代码头部非常直观 <https://github.com/kennethcachia/Background-Check/blob/master/background-check.js>
*/
Mock.Util = Util
// Mock.FakeXMLHttpRequest = FakeXMLHttpRequest
Mock.Random = Random
Mock.heredoc = Util.heredoc
/*
For Module Loader
*/
if (typeof module === 'object' && module.exports) {
// CommonJS
module.exports = Mock
} else if (typeof define === "function" && define.amd) {
// AMD modules
define('mock', [], function() {
return Mock
})
define('mockjs', [], function() {
return Mock
})
} else if (typeof define === "function" && define.cmd) {
// CMD modules
define(function() {
return Mock
})
}
// else {
// other, i.e. browser
this.Mock = Mock
this.Random = Random
// }
// For KISSY
if (typeof KISSY != 'undefined') {
/*
KISSY.use('components/mock/index', function(S, Mock) {
console.log(Mock.mock)
})
*/
Util.each([
'mock', 'components/mock/', 'mock/dist/mock',
'gallery/Mock/0.1.9/'
], function register(name) {
KISSY.add(name, function(S) {
Mock.mockjax(S)
return Mock
}, {
requires: ['ajax']
})
})
}