Skip to content

Commit

Permalink
Merge pull request DefinitelyTyped#28332 from AlexJerabek/AlexJ-Setti…
Browse files Browse the repository at this point in the history
…ngsEvent

[office-js] Adding SettingsChangedEventArgs
  • Loading branch information
DanielRosenwasser authored Aug 24, 2018
2 parents 32ba32e + dbe5e3e commit a0e3c95
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion types/office-js/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4276,6 +4276,7 @@ declare namespace Office {
*
* The Settings object is automatically loaded as part of the Document object, and is available by calling the settings property of that object
* when the add-in is activated.
*
* The developer is responsible for calling the saveAsync method after adding or deleting settings to save the settings in the document.
*/
interface Settings {
Expand All @@ -4293,7 +4294,7 @@ declare namespace Office {
* You can add multiple event handlers for the specified eventType as long as the name of each event handler function is unique.
*
* @param eventType Specifies the type of event to add. Required.
* @param handler The event handler function to add. Required.
* @param handler The event handler function to add, whose only parameter is of type {@link Office.SettingsChangedEventArgs}. Required.
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}.
*
Expand Down Expand Up @@ -4585,6 +4586,52 @@ declare namespace Office {
*/
set(name: string, value: any): void;
}
/**
* Provides information about the settings that raised the settingsChanged event.
*
* @remarks
* <table><tr><td>Requirement Sets</td><td>Settings</td></tr></table>
*
* To add an event handler for the settingsChanged event, use the addHandlerAsync method of the
* {@link Office.Settings} object.
*
* The settingsChanged event fires only when your add-in's script calls the Settings.saveAsync method to persist
* the in-memory copy of the settings into the document file. The settingsChanged event is not triggered when the
* Settings.set or Settings.remove methods are called.
*
* The settingsChanged event was designed to let you to handle potential conflicts when two or more users are
* attempting to save settings at the same time when your add-in is used in a shared (co-authored) document.
*
* **Important:** Your add-in's code can register a handler for the settingsChanged event when the add-in
* is running with any Excel client, but the event will fire only when the add-in is loaded with a spreadsheet
* that is opened in Excel Online, and more than one user is editing the spreadsheet (co-authoring).
* Therefore, effectively the settingsChanged event is supported only in Excel Online in co-authoring scenarios.
*
* **Support details**
*
* A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application.
* An empty cell indicates that the Office host application doesn't support this interface.
*
* For more information about Office host application and server requirements, see
* {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}.
*
* *Supported hosts, by platform*
* <table>
* <tr><th> </th><th> Office for Windows desktop </th><th> Office Online (in browser) </th><th> Office for iPad </th></tr>
* <tr><td><strong> Excel </strong></td><td> </td><td> Y </td><td> </td></tr>
* <tr><td><strong> Word </strong></td><td> Y </td><td> Y </td><td> </td></tr>
* </table>
*/
interface SettingsChangedEventArgs {
/**
* Gets an {@link Office.Settings} object that represents the settings that raised the settingsChanged event.
*/
settings: Settings;
/**
* Get an {@link Office.EventType} enumeration value that identifies the kind of event that was raised.
*/
type: EventType;
}
/**
* Represents a slice of a document file.
*
Expand Down

0 comments on commit a0e3c95

Please sign in to comment.