NewInputGuard constructs a guard with sensible defaults. A nil logger is replaced with a no-op logger so callers in non-logged paths don't crash.
(logger *zap.Logger)
| 49 | // NewInputGuard constructs a guard with sensible defaults. A nil logger is |
| 50 | // replaced with a no-op logger so callers in non-logged paths don't crash. |
| 51 | func NewInputGuard(logger *zap.Logger) *InputGuard { |
| 52 | if logger == nil { |
| 53 | logger = zap.NewNop() |
| 54 | } |
| 55 | return &InputGuard{ |
| 56 | logger: logger, |
| 57 | debounceWindow: DefaultIntentDebounce, |
| 58 | flushTTYFn: flushTTYInput, |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | // WithDebounceWindow overrides the post-mount debounce duration. A value of |
| 63 | // zero or negative disables debouncing entirely (useful for unit tests). |
no outgoing calls