MCPcopy Index your code
hub / github.com/tinyplex/tinybase / registerAllCallbacks

Function registerAllCallbacks

test/unit/core/other/middleware.test.ts:3102–3160  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3100 let calls: Record<string, number>;
3101
3102 const registerAllCallbacks = () => {
3103 calls = {};
3104 middleware.addWillSetContentCallback((content) => {
3105 calls['willSetContent'] = (calls['willSetContent'] ?? 0) + 1;
3106 return content;
3107 });
3108 middleware.addWillSetTablesCallback((tables) => {
3109 calls['willSetTables'] = (calls['willSetTables'] ?? 0) + 1;
3110 return tables;
3111 });
3112 middleware.addWillSetTableCallback((tableId, table) => {
3113 calls['willSetTable'] = (calls['willSetTable'] ?? 0) + 1;
3114 return table;
3115 });
3116 middleware.addWillSetRowCallback((tableId, rowId, row) => {
3117 calls['willSetRow'] = (calls['willSetRow'] ?? 0) + 1;
3118 return row;
3119 });
3120 middleware.addWillSetCellCallback((tableId, rowId, cellId, cell) => {
3121 calls['willSetCell'] = (calls['willSetCell'] ?? 0) + 1;
3122 return cell;
3123 });
3124 middleware.addWillSetValuesCallback((values) => {
3125 calls['willSetValues'] = (calls['willSetValues'] ?? 0) + 1;
3126 return values;
3127 });
3128 middleware.addWillSetValueCallback((valueId, value) => {
3129 calls['willSetValue'] = (calls['willSetValue'] ?? 0) + 1;
3130 return value;
3131 });
3132 middleware.addWillDelTablesCallback(() => {
3133 calls['willDelTables'] = (calls['willDelTables'] ?? 0) + 1;
3134 return true;
3135 });
3136 middleware.addWillDelTableCallback((_tableId) => {
3137 calls['willDelTable'] = (calls['willDelTable'] ?? 0) + 1;
3138 return true;
3139 });
3140 middleware.addWillDelRowCallback((_tableId, _rowId) => {
3141 calls['willDelRow'] = (calls['willDelRow'] ?? 0) + 1;
3142 return true;
3143 });
3144 middleware.addWillDelCellCallback((_tableId, _rowId, _cellId) => {
3145 calls['willDelCell'] = (calls['willDelCell'] ?? 0) + 1;
3146 return true;
3147 });
3148 middleware.addWillDelValuesCallback(() => {
3149 calls['willDelValues'] = (calls['willDelValues'] ?? 0) + 1;
3150 return true;
3151 });
3152 middleware.addWillDelValueCallback((_valueId) => {
3153 calls['willDelValue'] = (calls['willDelValue'] ?? 0) + 1;
3154 return true;
3155 });
3156 middleware.addWillApplyChangesCallback((changes) => {
3157 calls['willApplyChanges'] = (calls['willApplyChanges'] ?? 0) + 1;
3158 return changes;
3159 });

Callers 1

middleware.test.tsFile · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…