what is the meaning of object as an argument of an event

event parameter
function with event as parameter
js event handler parameter
pass parameter to event handler javascript
event js parameter
passing event as parameter in javascript
javascript event object e
event parameter typescript

I was trying to understand a piece of code but couldn't able to understand. What is the meaning or significant of the below snippet of code 'onSelect({ selected })'


export class SingleSelectionComponent {
  rows = [];
  selected = [];
  columns: any[] = [{ prop: 'name' }, { name: 'Company' }, { name: 'Gender' }];

  constructor() {
    this.fetch(data => {
      this.selected = [data[2]];
      this.rows = data;

  onSelect({ selected }) {
    console.log('Select Event', selected, this.selected);


Can anyone tell me what is the meaning of this onSelect({ selected })?

It is called as Destructuring assignment. Reference : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment.

It helps you in picking the required properties only rather than the entire object, In your case the required property is just the "selected" property from the MouseEvent Object.

Could somebody explain the use of the "event" parameter used in , on Jul 5, 2016. When an event handler function is called (for this example, that happens when the mouse button is clicked), it is given an event object as a parameter. One of the methods of an event object is preventDefault, which cancels the normal processing of the event. To create a custom event data class, create a class that derives from the EventArgs class and provide the properties to store the necessary data. The name of your custom event data class should end with EventArgs. To pass an object that does not contain any data, use the Empty field.

This is a so-called "destructuring" or deconstruction of the data passed.

It receives the entire MouseEvent, this way only the MouseEvent.selected is passed to the function to be handled.

[PDF] The Event Argument a.., The Event Argument, Chapter 1. Verb meanings and argument structure can a type mismatch force direct objects to leave their base positions, then. If. Event Object. All event objects in the DOM are based on the Event Object. Therefore, all other event objects (like MouseEvent and KeyboardEvent) has access to the Event Object's properties and methods.

Basically this is called Destructuring assignment. It is used to unpack unpack values from arrays, or properties from objects, into distinct variables.

Lets simplify

For ex.

you have an object obj and and a function onSelect

let obj = {'name': 'user1', 'rank': '1', 'selected': true};

with Destructuring

function onSelect({ selected }) {         // Unpacking fields from objects passed as function parameter

with out Destructuring

function onSelect( param) {     

we can call onSelect(obj);

as you see with out Destructuring we have to use dot notation to access that properties. so to reduce the code we can directly access properties with the help of Destructuring

For more info please check this

Hope this helps you!

[PDF] Unit 5, the meaning delivered by the combination of the verb and the object. See Kratzer's chapters The Event Argument and the Semantics of Verbs posted. An event is a notification sent by an object to signal the occurrence of an action. Events in .NET follow the observer design pattern.. The class who raises events is called Publisher, and the class who receives the notification is called Subscriber.

Event and Listener Concepts - MATLAB & Simulink, After creating an object of the event-declaring class, attach listener to that object. to listener callbacks by passing an event data argument to the callback function . EventName — The event name as defined in the class event block. sender refers to the object that invoked the event that fired the event handler. This is useful if you have many objects using the same event handler. EventArgs is something of a dummy base class. In and of itself it's more or less useless, but if you derive from it, you can add whatever data you need to pass to your event handlers.

Event handlers, You can define Event handlers, scripts that are automatically executed when an The keyword this refers to the current object-in the above example, the button the compute() function, with this.form, the current form, as the parameter to the � object definition: 1. a thing that you can see or touch but that is not usually a living animal, plant, or person: 2…. Learn more.

Passing Arguments to Event Listeners, By default, the native JavaScript event object is passed as the first argument to the method that we define, unless we actively change this. Sometimes inside an event handler function, you might see a parameter specified with a name such as event, evt, or simply e. This is called the event object, and it is automatically passed to event handlers to provide extra features and information. For example, let's rewrite our random color example again slightly: