2021-09-11 17:50:36 -04:00
|
|
|
import statusgo_backend/browser as status_browser
|
2021-09-08 14:05:39 -04:00
|
|
|
import ../eventemitter
|
|
|
|
import ./types/[bookmark]
|
|
|
|
|
|
|
|
type
|
|
|
|
BrowserModel* = ref object
|
|
|
|
events*: EventEmitter
|
|
|
|
|
|
|
|
proc newBrowserModel*(events: EventEmitter): BrowserModel =
|
|
|
|
result = BrowserModel()
|
|
|
|
result.events = events
|
|
|
|
|
2021-09-28 21:21:50 +02:00
|
|
|
proc storeBookmark*(self: BrowserModel, bookmark: Bookmark): Bookmark =
|
|
|
|
return status_browser.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) =
|
|
|
|
status_browser.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] =
|
2021-09-08 14:05:39 -04:00
|
|
|
result = status_browser.getBookmarks()
|
|
|
|
|
|
|
|
proc deleteBookmark*(self: BrowserModel, url: string) =
|
|
|
|
status_browser.deleteBookmark(url)
|