recent
import "github.com/tangoui/tango/sys/recent"本页由
site/tools/apigen从源码注释生成(按 darwin 构建标签选文件),请勿手改。
Package recent keeps the app's list of recently opened documents.
The list lives in recent.json in the app's config directory (service/paths: Config(app ID)), newest first, at most Max entries. On macOS each Add is also reported to NSDocumentController, so the Dock menu's recent items follow it (macOS lists only document types the app declares in its Info.plist).
Pair it with App.OnOpenFiles to record what the OS asks the app to open:
app.OnOpenFiles(func(paths []string) {
for _, p := range paths {
open(p)
recent.Add(app, p)
}
})
常量
const Max = 10Max is how many entries the list keeps.
函数
func Add
func Add(a *tango.App, path string) errorAdd puts path at the top of the list (made absolute; a repeat moves up). Safe from any goroutine.
func Clear
func Clear(a *tango.App) errorClear empties the list, and the system's on macOS.
func List
func List(a *tango.App) ([]string, error)List returns the list, newest first, leaving out files that no longer exist.
func Remove
func Remove(a *tango.App, path string) errorRemove drops path from the list. The macOS list is not changed: AppKit has no call to remove one entry.