@titanium/turbo
Version:
<p align="center"> <img src="https://cdn.secure-api.org/images/turbo-title_400.png" /><br> <a href="https://www.npmjs.com/package/@titanium/turbo"> <img src="https://img.shields.io/npm/v/@titanium/turbo.png" /> </a> </p>
25 lines (20 loc) • 445 B
JavaScript
var fighters = Alloy.Collections.fighters;
var counter = 1;
function showId(e) {
if (e.row.model) {
alert(e.row.model);
}
}
function addTestFighter(e) {
// create the test fighter model
var model = Alloy.createModel('fighters', {
name: 'Name ' + counter,
nickname: 'Nickname ' + counter
});
counter++;
// add model to the collection and save it to sqlite
fighters.add(model);
model.save();
}
fighters.fetch();
$.index.open();