jeffmitchel / meteor-local-persist Goto Github PK
View Code? Open in Web Editor NEWPersistent client (browser) collections for Meteor, using localStorage.
License: Other
Persistent client (browser) collections for Meteor, using localStorage.
License: Other
Hi,
I have tried with this package with one of my Ionic-meteor application to get data persistence on device.
It gets data from server using Meteor DDP when device has network connection.
users = new Mongo.Collection('user');
this stores data into IndexedDB.
myPersistDiscussions = new PersistentMinimongo2(users, 'MyApp');
I have added one observer to keep data synced.
var myPersistDiscussionsObserver = new PersistentMinimongo2(users, 'MyApp');
Now I am able to get data from meteor collection named "users".
$scope.listData = $meteor.collection(function() {
return users.find();
});
Issue :
It gets data from server using Meteor DDP when device has network connection.
It gets data from device's meteor collection (Cached data) when device has no network connection but application is in memory.
It is not getting data from persistent database when you removed the application from memory and internet connection is not available on device.
Please let me know if anybody has tried this thing or done successfully before.
In my app, I wait for the subscriptions to finish before rendering. This takes a while on 3G, so I'd like to save the contents of the collections in localstorage, and on the next page load, restore from localstorage to Meteor.Collection
s and immediately render, and then call the subscriptions.
It would be nice to use this package without jQuery, the package is not that Dom traversal dependant so this should be super easy to fix.
I would like to revive your package, as it seems fine to me. Either i will publish it under a new name, or you can add me as a collaborator, though i would like to change the name, to make it more findable (so i better publish a new one) :)
Just as a info
Hello, When i test your example like this :
// create a local collection,
var shoppingCart = new Meteor.Collection('shopping-cart', {connection: null});
// create a local persistence observer
var shoppingCartObserver = new LocalPersist(shoppingCart, 'myShoppingApp');
shoppingCart.insert({ item: 'DMB-01'+Math.floor(Math.random() * 10), quantity: Math.floor(Math.random() * 10) });
console.log(shoppingCart.find({}).fetch())
when i refresh the page and fetch the collection, only the newly inserted data is returned by the fetch so there are no persistents data.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.