-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstubs.js
58 lines (50 loc) · 1.53 KB
/
stubs.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
/*!
* jQuery Mobile Widget @VERSION
*
* Copyright (C) TODO
* License: TODO
* Authors: Salvatore Iovene <[email protected]>
*/
ensureNS("jQuery.mobile.todons");
/**
* This file contains stubs for the Web APIs.
* The stub can be used for testing purposes.
*/
jQuery.extend(jQuery.mobile.todons, {
/*
* Functions for the Addressbook module.
*/
PendingOperation: function() {
this.cancel = function() {
}
},
Person: function(id) {
this._id = id;
this.id = function() {
return this._id;
}
// TODO: this is not the real API!
this.avatar = function() {
return "images/avatar.png";
}
},
AddressBook: function() {
this.findPersons = function(
successCallback, errorCallback, filter, sortOrders,
attributesOfInterest)
{
persons = new Array(
new $.mobile.todons.Person("Amy"),
new $.mobile.todons.Person("Betty"),
new $.mobile.todons.Person("Carl"),
new $.mobile.todons.Person("Felicia"),
new $.mobile.todons.Person("John"),
new $.mobile.todons.Person("Matts"),
new $.mobile.todons.Person("Rebecca"),
new $.mobile.todons.Person("Zoe"));
// Simulate some time to complete the operation.
setTimeout(function() { successCallback(persons); }, 1000);
return new $.mobile.todons.PendingOperation();
}
}
});