AlaSQL.js - JavaScript SQL database for browser and Node.js. Handles both traditional relational tables and nested JSON data (NoSQL). Export, store, and import data from localStorage, IndexedDB, or Excel.
alasql.fn.onchange = function(r) {
if(r.a == 123) console.log('Observable event!');
};;
alasql('CREATE TABLE one (a INT)');
alasql('CREATE TRIGGER two BEFORE INSERT ON one CALL onchange()');
alasql('INSERT INTO one VALUES (123)'); // This will fire onchange()
Executing this throws an error:
TypeError: Cannot read property 'a' of undefined. The parameter r is undefined
As an example, see the code for Example B at https://github.com/agershun/alasql/wiki/TRIGGER:
Executing this throws an error: