Skip to content

Commit 8dd13e5

Browse files
committed
fix jsdoc for updatehook
1 parent b78df58 commit 8dd13e5

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

src/api.js

+18-11
Original file line numberDiff line numberDiff line change
@@ -1457,17 +1457,12 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
14571457
* // This won't trigger any callback
14581458
* db.run("INSERT INTO users VALUES (2, 'Bob', 1)");
14591459
*
1460-
* @param {function|null} callback -
1461-
* Callback to be executed whenever a row changes.
1462-
* Set to `null` to unregister the callback.
1463-
* @param {string} callback.operation -
1464-
* 'insert', 'update', or 'delete'
1465-
* @param {string} callback.database -
1466-
* database where the change occurred
1467-
* @param {string} callback.table -
1468-
* table where the change occurred
1469-
* @param {number} callback.rowId -
1470-
* rowid of the changed row
1460+
* @param {Database~UpdateHookCallback|null} callback
1461+
* - Callback to be executed when a row changes. Takes the type of change,
1462+
* the name of the database, the name of the table, and the row id of the
1463+
* changed row.
1464+
* - Set to `null` to unregister.
1465+
* @returns {void}
14711466
*/
14721467
Database.prototype["updateHook"] = function updateHook(callback) {
14731468
if (this.updateHookFunctionPtr) {
@@ -1528,6 +1523,18 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
15281523
);
15291524
};
15301525

1526+
/**
1527+
* @callback Database~UpdateHookCallback
1528+
* @param {'insert'|'update'|'delete'} operation
1529+
* - The type of change that occurred
1530+
* @param {string} database
1531+
* - The name of the database where the change occurred
1532+
* @param {string} table
1533+
* - The name of the database's table where the change occurred
1534+
* @param {number} rowId
1535+
* - The [rowid](https://www.sqlite.org/rowidtable.html) of the changed row
1536+
*/
1537+
15311538
// export Database to Module
15321539
Module.Database = Database;
15331540
};

0 commit comments

Comments
 (0)