import type HackerNewsPlugin from "src/main" ; import { ItemView , WorkspaceLeaf } from "obsidian" ; import { VIEW_TYPE , VIEW_DISPLAY_TEXT , VIEW_ICON } from "src/_constants" ; import HackerNewsComponent from "./hackernewsView.svelte" ; export default class HackerNewsView extends ItemView { plugin : HackerNewsPlugin ; private _view : HackerNewsComponent ; constructor ( leaf , plugin ) { super ( leaf ) ; this . plugin = plugin ; } getViewType ( ) { return VIEW_TYPE ; } getDisplayText ( ) { return VIEW_DISPLAY_TEXT ; } getIcon ( ) { return VIEW_ICON ; } onClose ( ) { this . _view . $destroy ( ) ; return super . onClose ( ) ; } onOpen ( ) { this . _view = new HackerNewsComponent ( { target : this . contentEl , props : { manager : this . plugin . manager , } } ) ; this . _view . $set ( { refreshInterval : this . plugin . settings . defaultRefreshInterval , } ) ; return super . onOpen ( ) ; } }