zotero/chrome/chromeFiles/content/scholar
Dan Stillman 013af36855 Fixed some issues with object reloading -- because of the way JS closures work, simply overwriting the old object doesn't work, since the interface code retains a reference to the old object -- in other words, a memory leak and stale data. Existing item objects now reload in place instead. Same change made to collections, though I'll have to test that after I add Collection editing and save().
This behavior of JS has some implications for how interface code handles things like deletes. The following won't do what one might expect/desire (and my apologies if this is obvious or redundant, but I figure it's worth pointing out):

var item = Scholar.Items.get(1);
Scholar.debug(item);
Scholar.DB.query("DELETE FROM items WHERE itemID=1");
Scholar.Items.reloadAll();
Scholar.debug(item);

The last line will still display the old object, even though _items[1] has been deleted inside Scholar.Items. The following does work, however:

var item = Scholar.Items.get(1);
Scholar.debug(item);
Scholar.DB.query("DELETE FROM items WHERE itemID=1");
Scholar.Items.reloadAll();
var item = Scholar.Items.get(1);
Scholar.debug(item);

Now item is properly undefined. Moral of the story: object references need to be deleted manually after receiving delete notifications, for if external code still has references to deleted data objects, the data layer can't do much about it.
2006-06-02 19:48:22 +00:00
..
ingester Provide visual feedback for scraping 2006-06-02 18:22:34 +00:00
test - Implemented singleton XPCOM component to store core Scholar objects 2006-05-27 00:20:27 +00:00
xpcom Fixed some issues with object reloading -- because of the way JS closures work, simply overwriting the old object doesn't work, since the interface code retains a reference to the old object -- in other words, a memory leak and stale data. Existing item objects now reload in place instead. Same change made to collections, though I'll have to test that after I add Collection editing and save(). 2006-06-02 19:48:22 +00:00
folderTreeView.js Revised the way the ItemTreeView handles multiple-selection deletes. 2006-06-02 15:27:52 +00:00
include.js - Implemented singleton XPCOM component to store core Scholar objects 2006-05-27 00:20:27 +00:00
itemTreeView.js Revised the way the ItemTreeView handles multiple-selection deletes. 2006-06-02 15:27:52 +00:00
metadataPane.js Removed organizeWindow.xul/js (All this functionality is in overlay) 2006-06-01 16:40:43 +00:00
metadataPane.xul Removed organizeWindow.xul/js (All this functionality is in overlay) 2006-06-01 16:40:43 +00:00
overlay.js Revised the way the ItemTreeView handles multiple-selection deletes. 2006-06-02 15:27:52 +00:00
overlay.xul Revised the way the ItemTreeView handles multiple-selection deletes. 2006-06-02 15:27:52 +00:00
preferences.js Added basic preferences support. 2006-05-18 18:39:55 +00:00
preferences.xul Added basic preferences support. 2006-05-18 18:39:55 +00:00