...
Tornevall Networks ChromeDB-JS is a small utility to simplify database calls for Chrome (extensions). The idea was born through the extension "Tornevall Networks NetFilter - Chrome Extension: Network Tools". This part is still quite undocumented, but to create connections between Chrome and a database here's at least a few examples on how to use it. The current version can be downloaded from the link below (it's available but should be tested before considered a "public release").
...
Code Block | ||||
---|---|---|---|---|
| ||||
document.addEventListener('DOMContentLoaded', function() { var chromeDb = Tornevall_ChromeDB(); if (chromeDb.openDatabase('TornevallFacebookFilterMyExample', '1.2.0.0', 'Tornevall Networks Facebook FilterMy example')) { var configTable = ["parameter VARCHAR(64) NOT NULL", "value VARCHAR(255) NOT NULL", "PRIMARY KEY (parameter)"]; var filterTable = ["content VARCHAR(255) NOT NULL, contentType VARCHAR(16) NULL, PRIMARY KEY (content)"]; chromeDb.createTable("configuration", configTable); chromeDb.createTable("filter", filterTable);} } } |
The SELECT query
Picking up data from a database (SELECT) requires a callback, since the function built cannot return data from the direct call, so a query should look like this:
...