I'd like to add MongoDB / CouchDB as a backend for Fullcalendar. However I need to know when the event has been changed on the client side so I can trigger an update in the backend. Likewise I would need to set a delete callback that would be triggered once the event object was deleted on the client side.
Should the changes fail to propagate to the backend (connection or concurrency issues), the client side should revert to the oldest change saved in the backend.
From what I see about the updateEvent function it's at the view/GUI level and it's about updating/redrawing the View corresponding to the event. Can you please confirm this as well?
UPDATE: In essence I would like to add support in FullCalendar for object collections, collections such as those found in BackboneJS or AngularJS libraries.
Related
I have a list of transactions that are generated in seconds, I am using a wrapper to get these transactions so I made a rest api to get the transactions according to the no. But in the mean time the transaction will get generated more so how do I show the recent on as they generate continuously .
I want to create a Block Explorer on the private Ethereum blockchain using node.js as backend and angular.js as frontend.
You could use here Websockets.
For example Socket.io - https://github.com/socketio/socket.io
Here is Socket.io compoenent for Angular: https://github.com/btford/angular-socket-io
So when your transactions are generated, you will send Push message to client, and client will update it's transaction list.
Possibly the most common approach here, id you have control of contract mods, is to include event emitters for every important state change. This exposes your contract transactions in a detailed (even indexable) and inexpensive way.
On the client, you can use event watchers. This are easily configured with AngularJS. When events arrive, they invoke callbacks. You can do what you need to support the UI or offchain storage in the callback.
For example, you can append a row to an array in to Angular's view model. Angular does a good jub of updating the view when the data in the model as changed. So, a live updated display of transaction events as they arrive is quite feasible and not especially difficult.
Hope it helps.
Here is a problem that I am working on:
There is a view and it has a collection. I want to update the UI when the user interaction results in a model being added to the collection. The UI update should be instantaneous. If the web app is open in multiple browser tabs or windows then the view should get updated in all the tabs.
Possible Solution: Use localStorage for caching the data in the browser. Sync with the local server immediately and perform remote sync in the background. Bind UI updates with updates to the localStorage. There are plugins like Backbone.LocalStorage and Backbone.DualStorage. I went through their source code and these plugins do not take care of conflict resolution with server updates i.e. before syncing the data with the localStorage they donot check if the data was synced with the remote server.
Can anyone help me with this? Links to github repos, stackoverflow discussions are welcome.
I am new to Backbone and building an application as my first try at using the framework.
The application is a calendar that allows the calendar owner to publish a calendar and others to book appointments which are stored in a single collection on the server.
When users load the calendar, the backbone app instantiates and fetches the collection displaying all the available appointments in the view.
This means that multiple users can each view the same calendar on different machines, each from a different instance of the backbone app but each app running off the same remote collection.
My problem is that i need changes to the remote collection triggered by one user to be immediately available to any other active instance of the application in another browser.
Obviously, collection change events will be fired WITHIN each instance of the app when one user books an appointment but these wont be fired ACROSS all instances of the calendar running else where. So in other words i need remote changes to the collection triggered OUTSIDE of the app instance to be picked up by the app.
The only way i can think to do this is use a setInterval to continually poll the remote collection, either running a full fetch, or better still somehow checking if the remote collection differs to the local one, and updating the collection and re-rendering the view, but this seems a bit hackish and not how BB, as an event-driven framework, is meant to be used.
I wanted to ask if anyone else had ever solved this same problem of BB instances needing to listen to remote collection changes triggered outside the app, and if so how you dealt with it? I have already searched SO and not found answers to this in particular because I'm not even sure on the terminology to describe the problem.
I'm working on a mobile web app, where it is important to be able to continue working in offline mode if the connection is dropped, and have the data be sent whenever the connection is back up.
I'm experimenting with saving the object to LocalStorage on the error event, and deleting it from LocalStorage on the sync event. That seems to work fine, but where should I load it?
So far, I have overloaded Collection.fetch, to merge in the LocalStorage models and re-save them, but it feels kind of wonky.
Should I periodically try to re-sync the models until it succeeds?
The implementation:
https://gist.github.com/geon/7890291
I'm using backbone js with an xml api data feed. I have a top-level model for each page that receives the xml and converts it into json. I then have additional methods in the model that return specific parts of the json model to the specific views through a controller. This is all working as expected.
I would like to periodically (via setTimeout) update the top-level model and have it fire the change event and update the views. My question is where I should handle/initialize the firing of this periodic event to update the model since it's not really a user trigger event?
I'd give my model a startUpdate() method, an endUpdate() method, and an internal onTimerUpdate() method that did a fetch. You can then call, on the model, the startUpdate() and let it run as needed, pausing it when it would be inconvenient for a server-side update to run (say, in the middle of a customer manipulation of the data), and restarting it after a client-side change had successfully completed a write to the server.
Better yet, you could make it a mixin and use it with a number of different models.