Skip to content

Commit

Permalink
pre-define unwatch
Browse files Browse the repository at this point in the history
  • Loading branch information
retorquere committed Mar 6, 2024
1 parent 1ff8e4f commit 8393b92
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion content/key-manager.ts
Expand Up @@ -89,7 +89,7 @@ export const KeyManager = new class _KeyManager {
primary: 'itemID',
indexes: ['itemKey', 'libraryID', 'citationKey', 'lcCitationKey'],
})
private unwatch: UnwatchCallback[]
private unwatch: UnwatchCallback[] = []

public query: {
field: { extra?: number, title?: number }
Expand Down
4 changes: 4 additions & 0 deletions setup/preferences.ts
Expand Up @@ -562,6 +562,7 @@ The Better BibTeX hidden preferences are preceded by “extensions.zotero.transl
}
let conditions: string = Object.entries(autoexport).map(([ setting, schema ]) => check(setting, schema)).join('\n')
triggers.push('DROP TRIGGER IF EXISTS betterbibtex.autoexport_insert')
triggers.push('DROP TRIGGER IF EXISTS betterbibtex_autoexport_insert')
triggers.push([
'CREATE TEMPORARY TRIGGER betterbibtex_autoexport_insert',
'BEFORE INSERT ON betterbibtex.autoexport',
Expand All @@ -572,6 +573,7 @@ The Better BibTeX hidden preferences are preceded by “extensions.zotero.transl

conditions = Object.entries(autoexport).filter(([ setting, _schema ]) => !fixated.includes(setting)).map(([ setting, schema ]) => check(setting, schema)).join('\n')
triggers.push('DROP TRIGGER IF EXISTS betterbibtex.autoexport_update')
triggers.push('DROP TRIGGER IF EXISTS betterbibtex_autoexport_update')
triggers.push([
'CREATE TEMPORARY TRIGGER betterbibtex_autoexport_update',
'BEFORE UPDATE ON betterbibtex.autoexport',
Expand Down Expand Up @@ -606,6 +608,7 @@ The Better BibTeX hidden preferences are preceded by “extensions.zotero.transl
const unsupported = ` SELECT RAISE(FAIL, "unsupported auto-export setting")\n WHERE NEW.setting NOT IN (${set(Object.keys(settings))});\n`
conditions = Object.entries(settings).map(([ setting, schema ]) => check(setting, schema, true)).join('\n')
triggers.push('DROP TRIGGER IF EXISTS betterbibtex.autoexport_setting_insert')
triggers.push('DROP TRIGGER IF EXISTS betterbibtex_autoexport_setting_insert')
triggers.push([
'CREATE TEMPORARY TRIGGER betterbibtex_autoexport_setting_insert',
'BEFORE INSERT ON betterbibtex.autoexport_setting',
Expand All @@ -616,6 +619,7 @@ The Better BibTeX hidden preferences are preceded by “extensions.zotero.transl
].join('\n'))

triggers.push('DROP TRIGGER IF EXISTS betterbibtex.autoexport_setting_update')
triggers.push('DROP TRIGGER IF EXISTS betterbibtex_autoexport_setting_update')
triggers.push([
'CREATE TEMPORARY TRIGGER betterbibtex_autoexport_setting_update',
'BEFORE UPDATE ON betterbibtex.autoexport_setting',
Expand Down

0 comments on commit 8393b92

Please sign in to comment.