mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
🤖 Merge PR #48159 Adding definition for SharedRuntime API in office-js and adding office.actions.associate in office-js-preview by @madhavagrawal17
* Updating the Office-js with Addin API and office-js-preview with the acoffice.actions.associate APi. * fixing the comments Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
This commit is contained in:
parent
9e16ef768a
commit
a0739729bc
13
types/office-js-preview/index.d.ts
vendored
13
types/office-js-preview/index.d.ts
vendored
@ -330,6 +330,10 @@ declare namespace Office {
|
||||
* @param useShortNamespace True to use the shortcut alias; otherwise false to disable it. The default is true.
|
||||
*/
|
||||
function useShortNamespace(useShortNamespace: boolean): void;
|
||||
/**
|
||||
* Provides a method for associating action names with functions that carry out an action.
|
||||
*/
|
||||
const actions: Actions;
|
||||
/**
|
||||
* Represents the add-in.
|
||||
*/
|
||||
@ -521,6 +525,15 @@ declare namespace Office {
|
||||
*/
|
||||
value: T;
|
||||
}
|
||||
/**
|
||||
* Used to associate an action name to a function.
|
||||
*/
|
||||
interface Actions {
|
||||
/**
|
||||
* Function to associate a name with the action function.
|
||||
*/
|
||||
associate: (actionName: string, action: (arg?: any) => void) => void;
|
||||
}
|
||||
/**
|
||||
* Message used in the `onVisibilityModeChanged` invocation.
|
||||
*/
|
||||
|
||||
76
types/office-js/index.d.ts
vendored
76
types/office-js/index.d.ts
vendored
@ -330,7 +330,37 @@ declare namespace Office {
|
||||
* @param useShortNamespace True to use the shortcut alias; otherwise false to disable it. The default is true.
|
||||
*/
|
||||
function useShortNamespace(useShortNamespace: boolean): void;
|
||||
/**
|
||||
* Represents the add-in.
|
||||
*/
|
||||
const addin: Addin;
|
||||
// Enumerations
|
||||
/**
|
||||
* Provides options to determine the startup behavior of the add-in upon next start-up.
|
||||
*/
|
||||
enum StartupBehavior {
|
||||
/**
|
||||
* The add-in does not load until opened by the user.
|
||||
*/
|
||||
none = 'None',
|
||||
/**
|
||||
* Load the add-in but do not show UI.
|
||||
*/
|
||||
load = 'Load',
|
||||
}
|
||||
/**
|
||||
* Visibility mode of the add-in.
|
||||
*/
|
||||
enum VisibilityMode {
|
||||
/**
|
||||
* UI is Hidden
|
||||
*/
|
||||
hidden = 'Hidden',
|
||||
/**
|
||||
* Displayed as taskpane
|
||||
*/
|
||||
taskpane = 'Taskpane',
|
||||
}
|
||||
/**
|
||||
* Specifies the result of an asynchronous call.
|
||||
*
|
||||
@ -481,7 +511,51 @@ declare namespace Office {
|
||||
*/
|
||||
value: T;
|
||||
}
|
||||
|
||||
/**
|
||||
* Message used in the `onVisibilityModeChanged` invocation.
|
||||
*/
|
||||
interface VisibilityModeChangedMessage {
|
||||
/**
|
||||
* Visibility changed state.
|
||||
*/
|
||||
visibilityMode: Office.VisibilityMode;
|
||||
}
|
||||
/**
|
||||
* Function type to turn off the event.
|
||||
*/
|
||||
type RemoveEventListener = () => Promise<void>;
|
||||
/**
|
||||
* Represents add-in level functionality for operating or configuring various aspects of the add-in.
|
||||
*/
|
||||
interface Addin {
|
||||
/**
|
||||
* Sets the startup behavior for the add-in for when the document is opened next time.
|
||||
* @param behavior - Specifies startup behavior of the add-in.
|
||||
*/
|
||||
setStartupBehavior(behavior: Office.StartupBehavior): Promise<void>;
|
||||
/**
|
||||
* Gets the current startup behavior for the add-in.
|
||||
*/
|
||||
getStartupBehavior(): Promise<Office.StartupBehavior>;
|
||||
/**
|
||||
* Shows the task pane associated with the add-in.
|
||||
* @returns A promise that is resolved when the UI is shown.
|
||||
*/
|
||||
showAsTaskpane(): Promise<void>;
|
||||
/**
|
||||
* Hides the task pane.
|
||||
* @returns A promise that is resolved when the UI is hidden.
|
||||
*/
|
||||
hide(): Promise<void>;
|
||||
/**
|
||||
* Adds a listener for the `onVisbilityModeChanged` event.
|
||||
* @param listener - The listener function that is called when the event is emitted. This function takes in a message for the receiving component.
|
||||
* @returns A promise that resolves when the listener is added.
|
||||
*/
|
||||
onVisibilityModeChanged(
|
||||
listener: (message: VisibilityModeChangedMessage) => void,
|
||||
): Promise<RemoveEventListener>;
|
||||
}
|
||||
/**
|
||||
* An interface that contains all the functionality provided to manage the state of the Office ribbon.
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user