From 109793e1056fa199608a2faf02523f3ff6a0055b Mon Sep 17 00:00:00 2001 From: nanaya Date: Tue, 21 Jan 2025 02:21:42 +0900 Subject: [PATCH] Explicit dependencies --- app/javascript/src/boot.coffee | 2 +- app/javascript/src/classes/autocomplete.coffee | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/javascript/src/boot.coffee b/app/javascript/src/boot.coffee index ebd36395..4b1233a3 100644 --- a/app/javascript/src/boot.coffee +++ b/app/javascript/src/boot.coffee @@ -51,7 +51,7 @@ window.TagCompletion = new TagCompletion window.TagScript = new TagScript window.UrlHash = new UrlHashHandler window.User = new User -window.autocomplete = new Autocomplete +window.autocomplete = new Autocomplete(window.TagCompletion) window.checkAll = new CheckAll window.comment = new Comment window.dmail = new Dmail diff --git a/app/javascript/src/classes/autocomplete.coffee b/app/javascript/src/classes/autocomplete.coffee index d95050e9..11d59ab4 100644 --- a/app/javascript/src/classes/autocomplete.coffee +++ b/app/javascript/src/classes/autocomplete.coffee @@ -1,4 +1,6 @@ import autocompleter from 'autocompleter' +import TagCompletion from './tag_completion' +import TagCompletionBox from './tag_completion_box' $ = jQuery @@ -7,7 +9,7 @@ autocompleterMap = (match) => value: match export default class Autocomplete - constructor: -> + constructor: (@tagCompletionInstance) -> $ => @_genericCompletionAll() @_tagCompletion() @@ -43,4 +45,4 @@ export default class Autocomplete return if !tags? new TagCompletionBox(tags) - TagCompletion?.observe_tag_changes_on_submit editForm, tags + @tagCompletionInstance.observe_tag_changes_on_submit editForm, tags