Comments (38)
It is, but it'll lead to some weird results - what's the use case?
On Wed, Jul 20, 2011 at 3:38 PM, csaunders <
[email protected]>wrote:
I may be wrong, but from what I understand of the code and can get from the
documentation it's currently not possible to use both schemes on a model.Reply to this email directly or view it on GitHub:
https://github.com/maccman/spine/issues/77
Alex MacCaw
+12147175129
@maccman
http://alexmaccaw.co.uk | http://www.leadthinking.com | http://socialmod.com
from spine.
To be able to have the app work when it's offline. So, I'd like to be able to store the Ajax response into local storage so that if you don't have a connection you can use that cached data instead.
from spine.
I would also like to know if this is possible so that it can be used as a cache. Models would always try to load their local data first unless it is not available, (which in that case would make an ajax request) or when refresh (?) is called to sync local/server data..
from spine.
+1
from spine.
Alex, I was looking into that as well. I have already used Spine for this situation but had to use neither of them libs.
I think that this calls "smart" sync logic. I mean many decisions must be made, and they depend on each case.
For example, when the app loads and it's online, should it update data that changed on the server into local storage. Should it update data that changed in localstorage into the server. What about conflicts?
I think is not about using both libs Local and Ajax, but creating another one that syncs between them; This will bring great value to the Framework.
from spine.
If localStorage / server database sync were properly implemented, it could make Spine the first of its kind, and could change the way people create offline apps. I think there's a lot of value in this idea.
from spine.
I'm working on this for Global Guide - I've written syncing libraries in the
past, so hopefully I can re-purpose one of those.
On Fri, Aug 5, 2011 at 1:24 PM, chetan51 <
[email protected]>wrote:
If localStorage / server database sync were properly implemented, it could
make Spine the first of its kind, and could change the way people create
offline apps. I think there's a lot of value in this idea.Reply to this email directly or view it on GitHub:
https://github.com/maccman/spine/issues/77#issuecomment-1737840
Alex MacCaw
+12147175129
@maccman
http://alexmaccaw.co.uk | http://www.leadthinking.com | http://socialmod.com
from spine.
Do it :)
from spine.
I'd love to help wherever I can. Just let me know.
from spine.
I agree, specially in the enterprise world.
I'am up for that too!
from spine.
+1. that would be great
from spine.
I actually need this functionality for an app I'm writing, so I'll likely create it if it doesn't already exist. I just wanna know what the plans are regarding this, so I don't end up either wasting my time or doing it wrong. If I do end up adding it, what guidelines should I follow? Maybe we can discuss this separately sometime?
from spine.
Alex, you know I am new @ this.
I've given several tries @ this on a case by case. I would really like to stop written them each time and develop a lib or an Spine Add-on instead.
I would really like to see it as part of Spine as in another add-one.
What do you think?
Alex: why don't you give us a push , a branch and a guideline on how you think this should be approached. I know you are all in on Global Guide; lets sit down and work on this for a full day then we'll see what happens.
from spine.
@rodriguezartav I have a Spine Plugins project that if you would like to add a SyncStore to I wouldn't have a problem with. Keep in mind my libraries were built back before Spine was written in Coffeescript.
from spine.
We need this for an app we're writing too, so we'll also be writing this if someone else hasn't already. Can anyone share code for this? We're brand-new at Spine (and Coffeescript) but we have a crazy deadline and will be happy to put in a pile of work over the next few days if we can help.
from spine.
+1 from me, though my app doesn't need sync, just the ability to push CUD to the server when the app transitions from offline to online.
from spine.
+1, would give spine a lot of value.
from spine.
I will be needing a functionality like this also. As Internet connectivity on mobile devices is spotty, this kind of automatic syncing is vital.
I will gladly test any code that becomes available (unfortunately, I am just starting to truly learn JS/CS and client-side MVC frameworks, so I am not able to build something like that myself yet).
from spine.
+1
from spine.
+1
from spine.
+1
sync management built in would be awesome! Hard to do in a way that pleases everyone, but the basic ideas/workflows of syncing would probably have a lot common in most cases, but you don't have to implement the workflow just some methods to help people do their own workflows
sync(id) and syncAll() methods on models that automatically uses spines Ajax might go a long way for my use case.
from spine.
+1
from spine.
+1
from spine.
I have a similar requirement wherever offline version is on a mobile device. I am leaning toward using CouchDb locally for storage. This has syncing built in and works well with Spine. You can even host the Spine app directly from CouchDb as a CouchApp, which means you can use the sync for app deployment too.
from spine.
Hello. I didn't know about this issue, but here's something that I'm working on: https://github.com/vojto/atmos2
At the moment it only supports fetching objects, but I've implemented the whole sync (the data was synced via WebSocket, but it sucked), so I'm expecting to get something fully working by the end of January.
Well, don't use it, I just wanted to let you know I'm working on this (and have been for a couple of months, I have Cocoa version -- but the WebSocket syncing wasn't a good idea, thus the rewriting.)
Hit me at vojto (at) me (dot) com, if you have any questions, or want to help.
Thanks
from spine.
Recently I've been writting several "plugin's" for Spine like Spine.Local and such;
I found it really simple to re-write Spine.Local and call it Spine.Sync
Then extend the Models you wan't to keep in one way sync with Spine.Sync , Spine.Sync has to keep track of lastUpdateDateTime for every model and store the models that are in Sync.
I do this trought another Plugin called SingleModel; Which is just a wrapper for a singleton class that gets persisted in LocalStorage. Look at it as a Spine.Model that consists of just one record
In the end, all you need to do is call fetch() on all objects extended by Spine.Sync , and it will automatically use lastUpdateDateTime to GET them from modified ones from the server and refresh them locally.
In my experience I don't like two way sync, but I normally work with enterprise apps that send to the server "quotes" or "opportunities" ; and I rather have the user send them manually and figure out if something is wrong. ( For example not enought products to fulfill the quote )
This is just a personal philosophy in regards to users, but implementing two-way sync using the same concept is pretty straight forward too. Keep a timestamp or a boolean of local records, monitor and send the required ones constantly.
from spine.
+1
from spine.
+1
from spine.
+1
from spine.
We need this feature to implement an offline mode in our app.
I'd love to help out if I can.
from spine.
+1
This would be awesome!
from spine.
+1
from spine.
+1, I have similar request when developing mockingbot.com, and I did lots of monkey patching to make AJAX and Local work together, expect an elegant way to achieve this.
from spine.
+1
Will try Atmos now, it looks promising. ( https://github.com/vojto/atmos2 )
from spine.
+1 This is good for offline app, such as a editor with a draft. I hope spine will provide a good a strategy.
from spine.
The interesting part is what happens when the application is back online. It is very important that you fire all the requests in the right order, Or your data is going south. I have an idea how you could implement such a feature. Is this one still open?
If there is still a need maybe I could do that one on the weekend.
from spine.
We'd love any pull requests related to this feature! It is a tough nut to crack.
from spine.
There is just one thing, this only works if all logic is handled in the frontend. Any data manipulation which is done on the server can kill this feature ... but I'll test what I can do. Got a couple of good ideas.
from spine.
Related Issues (20)
- code help( help with the completion of the code to run well) HOT 3
- testing new issue HOT 5
- Why there are two different spinejs? HOT 4
- Do not mix up instance property and local variable HOT 5
- Broken link to coffeescript in README
- Crashes if the browser doesn't support localStorage HOT 1
- Triggering refresh on model instance no longer triggers refresh on the model class HOT 9
- `isBlank` suppose to check the number? HOT 4
- Support multiple remote hosts (override Spine.Model.host) HOT 1
- 1.6 ajax create success and then auto ajax update HOT 9
- hasOne and hasMany calls inconsistent
- listeningTo the same event on different models is broken (events.split / cannot read property 'obj' of undefined / etc.) HOT 3
- Extend POST/DELETE fix from 1.6.0 to PUT calls HOT 1
- spinejs.com domain registration has expired HOT 3
- Model#changeID does not persist the new id HOT 1
- Documentation link in README.md is broken HOT 2
- Model foreign key reference with no id broken HOT 2
- Model.find unable to get correct result
- Hello. Is this project abandoned? HOT 2
- Pug support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spine.