forked from leotsai2012/phonegapmock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcordova.mock.js
61 lines (60 loc) · 1.63 KB
/
cordova.mock.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
60
61
if(window.navigator == undefined) {
window.navigator = { };
}
setTimeout(function () {
var event = new Event('deviceready');
document.dispatchEvent(event);
}, 2000);
if (window.cordova == undefined) {
window.cordova = {
exec: function (success, fail, className, methodName, paras) {
if (success != null) {
success();
}
}
};
}
navigator.contacts = {
find: function(contactFields, contactSuccess, contactError, contactFindOptions) {
var contacts = [
{
displayName: "Mike",
name: {
familyName: 'Capewell',
formatted:'Mike Capewell'
},
phoneNumbers: [
{
type: "string",
value: "0722829323123",
pref: false
}
]
},
{
displayName: "Leo",
name: {
familyName: 'Cai',
formatted:'Leo Cai'
},
phoneNumbers: [
{
type: "string",
value: "03837234343",
pref: false
},
{
type: "string",
value: "005543834",
pref: true
}
]
}
];
contactSuccess(contacts);
}
};
var ContactFindOptions = function() {
this.filter = "";
this.multiple = false;
};