Skip to content

Commit 91f5a0f

Browse files
committed
add Default
1 parent 704cdaa commit 91f5a0f

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### v0.8.0
2+
3+
- add SetDefault to make a Service globally accessing to add new structs.
4+
15
### v0.7.0
26

37
- add theme toggle button (dark,light,auto) (thx to @flaticols)

service.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,3 +250,14 @@ func (s *service) ExplorePath(newPath string, options ...ExploreOption) Service
250250
s.explorer.putObjectStartingAt(row, col, oa, placement)
251251
return s
252252
}
253+
254+
var defaultService Service
255+
256+
// SetDefault makes a service global available.
257+
// This can be used to explore new structs anywhere from a function.
258+
func SetDefault(s Service) {
259+
defaultService = s
260+
}
261+
func Default() Service {
262+
return defaultService
263+
}

0 commit comments

Comments
 (0)