Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
dev:client_coding:javascript_api [2019/01/22 04:23] – [The Zotero Object] dstillmandev:client_coding:javascript_api [2019/01/22 04:26] – [API Methods] dstillman
Line 63: Line 63:
  
 //The Zotero JavaScript API is under-documented, and at present requires a lot of looking around in the source code.  The most useful parts of the source code are in chrome/content/zotero/xpcom and xpcom/data, and the chrome/content/zotero (particularly zoteroPane.js and fileInterface.js).// //The Zotero JavaScript API is under-documented, and at present requires a lot of looking around in the source code.  The most useful parts of the source code are in chrome/content/zotero/xpcom and xpcom/data, and the chrome/content/zotero (particularly zoteroPane.js and fileInterface.js).//
- 
-Once you have access to the core Zotero object, you can use the objects and methods provided by the Zotero JavaScript API. 
- 
-Zotero uses a combination of instantiatable objects (e.g. ''Zotero.Item = function(){...}'') and singletons (''Zotero.Items = **new** function(){...}''). The most important example of the former is ''Zotero.Item'', which represents a single item in the database. Singletons are used mostly to group related static methods into a single namespace. 
  
 ==== Adding items and modifying data ==== ==== Adding items and modifying data ====
  
-A typical operation might include a call to ''Items.get()'' to retrieve an ''Item'' instance, calls to ''Item'' methods on the retrieved object to modify data, and finally a ''save()'' to save the modified data to the database.+A typical operation might include a call to ''Zotero.Items.get()'' to retrieve ''Zotero.Item'' instance, calls to ''Zotero.Item'' methods on the retrieved object to modify data, and finally a ''save()'' (within a transaction) or ''saveTx()'' (outside a transaction) to save the modified data to the database.
  
 <code javascript> <code javascript>
dev/client_coding/javascript_api.txt · Last modified: 2022/07/02 18:22 by dstillman