OfficeExtension.EventHandlers class
Constructors
(constructor)(context, parent |
Constructs a new instance of the |
Methods
add(handler) | Adds a function to be called when the event is triggered. |
remove(handler) | Removes the specified function from the event handler list so that it will not be called on subsequent events. Note: The same RequestContext object that the handler was added in must be used when removing the handler. More information can be found in Remove an event handler. |
Constructor Details
(constructor)(context, parentObject, name, eventInfo)
Constructs a new instance of the EventHandlers
class
constructor(context: ClientRequestContext, parentObject: ClientObject, name: string, eventInfo: EventInfo<T>);
Parameters
- parentObject
- OfficeExtension.ClientObject
- name
-
string
- eventInfo
Method Details
add(handler)
Adds a function to be called when the event is triggered.
add(handler: (args: T) => Promise<any>): EventHandlerResult<T>;
Parameters
- handler
-
(args: T) => Promise<any>
A promise-based function that takes in any relevant event arguments.
Returns
remove(handler)
Removes the specified function from the event handler list so that it will not be called on subsequent events.
Note: The same RequestContext object that the handler was added in must be used when removing the handler. More information can be found in Remove an event handler.
remove(handler: (args: T) => Promise<any>): void;
Parameters
- handler
-
(args: T) => Promise<any>
A reference to a function previously provided to the add
method as an event handler.
Returns
void
Office Add-ins