<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSWindow/discardEvents(matching:before:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSWindow(im)discardEventsMatchingMask:beforeEvent:"
  },
  "title" : "discardEvents(matching:before:)"
}
-->

# discardEvents(matching:before:)

Forwards the message to the global application object.

```
func discardEvents(matching mask: NSEvent.EventTypeMask, before lastEvent: NSEvent?)
```

## Parameters

`mask`

The mask of the events to discard.

`lastEvent`

The event up to which queued events are discarded from the queue.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)