Office.OfficeThemeChangedEventArgs interface

提供引发 Office.EventType.OfficeThemeChanged 事件的更新的 Office 主题。

注解

[ API set: Mailbox 1.14 ]

示例

// Adds an event handler for the OfficeThemeChanged event.
Office.onReady(() => {
    document.addEventListener('DOMContentLoaded', () => {
        // Get a reference to the mailbox and use it to add an event handler.
        const mailbox = Office.context.mailbox;
        mailbox.addHandlerAsync(Office.EventType.OfficeThemeChanged, officeThemeChangedHandler, (result) => {
            if (result.status === Office.AsyncResultStatus.Failed) {
                console.error(`Failed to add event handler: ${asyncResult.error.message}`);
                return;
            }

            console.log("Event handler added successfully.");
        });
    });
});

// Handles the OfficeThemeChanged event.
function officeThemeChangedHandler(event) {
    console.log(`Event: ${event.type}`);
    const currentTheme = event.officeTheme;
    // Perform operations based on the current theme.
}

属性

officeTheme

获取更新的 Office 主题。

type

获取事件的类型。 有关详细信息,请参阅 Office.EventType

属性详细信息

officeTheme

获取更新的 Office 主题。

officeTheme: Office.OfficeTheme;

属性值

注解

[ API set: Mailbox 1.14 ]

type

获取事件的类型。 有关详细信息,请参阅 Office.EventType

type: "officeThemeChanged";

属性值

"officeThemeChanged"

注解

[ API set: Mailbox 1.14 ]