Code Monkey home page Code Monkey logo

Comments (38)

maccman avatar maccman commented on June 12, 2024

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.

csaunders avatar csaunders commented on June 12, 2024

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.

erfanimani avatar erfanimani commented on June 12, 2024

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.

chetan51 avatar chetan51 commented on June 12, 2024

+1

from spine.

rodriguezartav avatar rodriguezartav commented on June 12, 2024

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.

chetan51 avatar chetan51 commented on June 12, 2024

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.

maccman avatar maccman commented on June 12, 2024

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.

chetan51 avatar chetan51 commented on June 12, 2024

Do it :)

from spine.

chetan51 avatar chetan51 commented on June 12, 2024

I'd love to help wherever I can. Just let me know.

from spine.

rodriguezartav avatar rodriguezartav commented on June 12, 2024

I agree, specially in the enterprise world.

I'am up for that too!

from spine.

arief-hidayat avatar arief-hidayat commented on June 12, 2024

+1. that would be great

from spine.

chetan51 avatar chetan51 commented on June 12, 2024

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.

rodriguezartav avatar rodriguezartav commented on June 12, 2024

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.

csaunders avatar csaunders commented on June 12, 2024

@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.

adriand avatar adriand commented on June 12, 2024

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.

martron avatar martron commented on June 12, 2024

+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.

hjortureh avatar hjortureh commented on June 12, 2024

+1, would give spine a lot of value.

from spine.

lagartoflojo avatar lagartoflojo commented on June 12, 2024

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.

agronemann avatar agronemann commented on June 12, 2024

+1

from spine.

zdk avatar zdk commented on June 12, 2024

+1

from spine.

aeischeid avatar aeischeid commented on June 12, 2024

+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.

jfmoy avatar jfmoy commented on June 12, 2024

+1

from spine.

jaehess avatar jaehess commented on June 12, 2024

+1

from spine.

petebacondarwin avatar petebacondarwin commented on June 12, 2024

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.

vojto avatar vojto commented on June 12, 2024

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.

rodriguezartav avatar rodriguezartav commented on June 12, 2024

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.

Deschtex avatar Deschtex commented on June 12, 2024

+1

from spine.

michaelgodshall avatar michaelgodshall commented on June 12, 2024

+1

from spine.

adambiggs avatar adambiggs commented on June 12, 2024

+1

from spine.

adambiggs avatar adambiggs commented on June 12, 2024

We need this feature to implement an offline mode in our app.

I'd love to help out if I can.

from spine.

mwoods79 avatar mwoods79 commented on June 12, 2024

+1

This would be awesome!

from spine.

christophehurpeau avatar christophehurpeau commented on June 12, 2024

+1

from spine.

yzhang avatar yzhang commented on June 12, 2024

+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.

kevinJread avatar kevinJread commented on June 12, 2024

+1
Will try Atmos now, it looks promising. ( https://github.com/vojto/atmos2 )

from spine.

reducm avatar reducm commented on June 12, 2024

+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.

Poltergeist avatar Poltergeist commented on June 12, 2024

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.

aeischeid avatar aeischeid commented on June 12, 2024

We'd love any pull requests related to this feature! It is a tough nut to crack.

from spine.

Poltergeist avatar Poltergeist commented on June 12, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.