fthuin / yahoofinance-cinnamon-desklet

A cinnamon desklet that retrieves quotes data from Yahoo! Finance
GNU General Public License v3.0
8 stars 2 forks source link

Asynchronously retrieve data #6

Open fthuin opened 8 years ago

fthuin commented 8 years ago

Sometimes cinnamon freezes because of this desklet when the internet connection is slow.

We should use the library Soup

const Soup = imports.gi.Soup;

Use an unique asynchronous session

var session = new Soup.SessionAsync();

And link a GET request to a callback method _onResponse (for example)

var urlcatch = Soup.Message.new("GET", url);
session.queue_message(urlcatch, Lang.bind(this, this._onResponse));

For more information, look at the code on Spices which already uses it, but the Object-oriented version stored here doesn't.

Crafter6432 commented 6 years ago

It also seems like the stocks are updated evertyime the list of symbols is edited(even if its only a single character), this makes editing the symbols nearly impossible on a slow connection.

fthuin commented 6 years ago

@Crafter6432 Thank you for reporting this issue. However, the official desklet is now hosted by the Linux Mint team at https://github.com/linuxmint/cinnamon-spices-desklets and this desklet is named stocks@fthuin. Could you please open an issue there?