| 1 |
define(["dojo/dom", "dojo/dom-style", "dojo/_base/connect","dijit/registry", "dojo/sniff", "dojox/mobile/TransitionEvent"], |
| 2 |
function(dom, domStyle, connect, registry, has, TransitionEvent){ |
| 3 |
var _connectResults = []; |
| 4 |
var list = null; |
| 5 |
var listId = 'list6'; |
| 6 |
var backId = 'sc6back1'; |
| 7 |
var insert10Id = 'sc6insert10x'; |
| 8 |
var app = null; |
| 9 |
var MODULE = "V6"; |
| 10 |
|
| 11 |
var loadMore = function(){ |
| 12 |
if(!app){ |
| 13 |
return; |
| 14 |
} |
| 15 |
if(!app.listStart){ |
| 16 |
app.listStart = 1; |
| 17 |
app.listCount = 5; |
| 18 |
} |
| 19 |
setTimeout(function(){ |
| 20 |
for(var i = app.listStart; i < app.listStart+5; i++){ |
| 21 |
var newdata = {'label': 'Item #'+i}; |
| 22 |
app.stores.longlistStore.store.put(newdata); |
| 23 |
} |
| 24 |
app.listStart += app.listCount; |
| 25 |
app.listTotal = app.listStart-1; |
| 26 |
return false; |
| 27 |
}, 500); |
| 28 |
}; |
| 29 |
return { |
| 30 |
init: function(){ |
| 31 |
app = this.app; |
| 32 |
|
| 33 |
var connectResult = connect.connect(dom.byId(insert10Id), "click", function(){ |
| 34 |
|
| 35 |
loadMore(); |
| 36 |
}); |
| 37 |
_connectResults.push(connectResult); |
| 38 |
}, |
| 39 |
|
| 40 |
|
| 41 |
beforeActivate: function(){ |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
if(dom.byId(backId) && !has("phone")){ |
| 46 |
domStyle.set(dom.byId(backId), "visibility", "hidden"); |
| 47 |
} |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
}, |
| 61 |
afterActivate: function(){ |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
if(!this.app.timedAutoFlow && !this.app.timed100Loops){ |
| 80 |
return; |
| 81 |
} |
| 82 |
this.app.loopCount++; |
| 83 |
|
| 84 |
var liWidget = null; |
| 85 |
if(this.app.timed100Loops){ |
| 86 |
if(this.app.loopCount < 100) { |
| 87 |
if(history){ |
| 88 |
history.back(); |
| 89 |
} |
| 90 |
}else{ |
| 91 |
console.log("P1:afterActivate loopCount = 100 stop timer"); |
| 92 |
console.timeEnd("timing transition loop"); |
| 93 |
} |
| 94 |
return; |
| 95 |
} |
| 96 |
|
| 97 |
if(this.app.loopCount === 10){ |
| 98 |
liWidget = registry.byId("dojox_mobile_ListItem_0"); |
| 99 |
}else if(this.app.loopCount === 12) { |
| 100 |
liWidget = registry.byId("dojox_mobile_ListItem_3"); |
| 101 |
}else if(this.app.loopCount === 13) { |
| 102 |
liWidget = registry.byId("dojox_mobile_ListItem_15"); |
| 103 |
} |
| 104 |
if(liWidget){ |
| 105 |
var ev = new TransitionEvent(liWidget.domNode, liWidget.params); |
| 106 |
ev.dispatch(); |
| 107 |
} |
| 108 |
}, |
| 109 |
beforeDeactivate: function(){ |
| 110 |
|
| 111 |
}, |
| 112 |
afterDeactivate: function(){ |
| 113 |
|
| 114 |
}, |
| 115 |
|
| 116 |
destroy: function(){ |
| 117 |
var connectResult = _connectResults.pop(); |
| 118 |
while(connectResult){ |
| 119 |
connect.disconnect(connectResult); |
| 120 |
connectResult = _connectResults.pop(); |
| 121 |
} |
| 122 |
} |
| 123 |
}; |
| 124 |
}); |