Init applies a final set of options to the API and marks initialization as done. This method can only be called once.
(opts ...Option)
| 383 | // Init applies a final set of options to the API and marks |
| 384 | // initialization as done. This method can only be called once. |
| 385 | func (api *API) Init(opts ...Option) { |
| 386 | api.mu.Lock() |
| 387 | defer api.mu.Unlock() |
| 388 | if api.closed || api.initDone { |
| 389 | return |
| 390 | } |
| 391 | api.initDone = true |
| 392 | |
| 393 | for _, opt := range opts { |
| 394 | opt(api) |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | // Start starts the API by initializing the watcher and updater loops. |
| 399 | // This method calls Init, if it is desired to apply options after |