status-lib/status/browser.nim

29 lines
816 B
Nim
Raw Normal View History

# import statusgo_backend/browser as status_browser
2021-09-08 14:05:39 -04:00
import ../eventemitter
import ../types/[bookmark]
import ../backends/backend
2021-09-08 14:05:39 -04:00
type
BrowserModel* = ref object
events*: EventEmitter
backend*: Backend
2021-09-08 14:05:39 -04:00
proc newBrowserModel*(events: EventEmitter, backend: Backend): BrowserModel =
2021-09-08 14:05:39 -04:00
result = BrowserModel()
result.events = events
result.backend = backend
2021-09-08 14:05:39 -04:00
2021-09-28 21:21:50 +02:00
proc storeBookmark*(self: BrowserModel, bookmark: Bookmark): Bookmark =
return self.backend.storeBookmark(bookmark)
2021-09-08 14:05:39 -04:00
2021-09-28 21:21:50 +02:00
proc updateBookmark*(self: BrowserModel, originalUrl: string, bookmark: Bookmark) =
self.backend.updateBookmark(originalUrl, bookmark)
2021-09-08 14:05:39 -04:00
2021-09-28 21:21:50 +02:00
proc getBookmarks*(self: BrowserModel): seq[Bookmark] =
result = self.backend.getBookmarks()
2021-09-08 14:05:39 -04:00
proc deleteBookmark*(self: BrowserModel, url: string) =
self.backend.deleteBookmark(url)