Aleksey Kulikov
I write javascript and sometimes talk about css and offline web.
class Dreams extends Backbone.Collection
url: '/api/dreams'
initialize: ->
@storage = new Offline.Storage('dreams', this)
# your code ...
// set
storage({ key: 'val', key2: 'val2'}, function(err) {});
// get
storage('key', function(err, val) {});
storage(['key', 'key2'], function(err, all) {}); // all.length == 2
// count
storage(function(err, count) {}); // count == 2
// delete
storage('key', null, function(err) {});
storage(['key', 'key2'], null, function(err) {});
var treo = require('treo'); // or window.treo
var schema = treo.schema()
.version(1)
.addStore('books', { key: 'isbn' })
.addIndex('byTitle', 'title', { unique: true })
.addIndex('byAuthor', 'author')
.version(2)
.getStore('books')
.addIndex('byYear', 'year');
var db = treo('library', schema);
db.store('books').batch([
{ isbn: 123456, title: 'Quarry Memories', author: 'Fred', year: 2012 },
{ isbn: 234567, title: 'Water Buffaloes', author: 'Fred', year: 2012 },
{ isbn: 345678, title: 'Bedrock Nights', author: 'Barney', year: 2013 },
], function(err) {});
// get a single book by title using an index
books.index('byTitle').get('Bedrock Nights', function(err, book) {});
// get all books filtered by author
books.index('byAuthor').get('Fred', function(err, all) {}); // all.length == 2
Моё решение
Работы хватит на всех!
создавать экспериментальные приложения
экспериментировать с service worker
вычитывать спецификации
By Aleksey Kulikov
Perm.js Meetup
I write javascript and sometimes talk about css and offline web.