// A NamedAction describes an Action that also has a unique identifier. This // interface is used by the Debounce Executor to prevent duplicate actions from // running concurrently. type NamedAction interface { Action // ID returns the name for this Action. Identical actions // should return the same ID value. ID() string } type namedAction struct { ActionFunc name string } func (a namedAction) ID() string { return a.name } // Named creates a NamedAction from fn, with n as its name. This function is // just a helper to simplify creating NamedActions. func Named(n string, fn ActionFunc) NamedAction { return namedAction{ ActionFunc: fn, name: n, } }