You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

28 lines
726 B

class PostEditorService extends EventTarget {
static instance: PostEditorService
isSuggestionPopupOpen = false
constructor() {
super()
if (!PostEditorService.instance) {
PostEditorService.instance = this
}
return PostEditorService.instance
}
closeSuggestionPopup() {
if (this.isSuggestionPopupOpen) {
this.isSuggestionPopupOpen = false
this.dispatchEvent(new CustomEvent('closeSuggestionPopup'))
}
}
/** Opens the main “new note” composer (same as sidebar / write button). Listeners run login check. */
requestOpenNewPost() {
this.dispatchEvent(new CustomEvent('requestOpenNewPost'))
}
}
const instance = new PostEditorService()
export default instance