Office.OnReadyOptions interface
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Provides options related to the onReady event.
Remarks
Examples
// Enable rejection behavior for the onReady promise.
Office.onReadyOptions?.setRejectionEnabled();
// Now the onReady promise can be rejected if failures are encountered during its setup.
Office.onReady((info) => {
console.log(`Host: ${info.host}, Platform: ${info.platform}`);
}).catch((error) => {
console.error("Office.js initialization failed:", error);
});
Properties
| set |
Enables the behavior that allows the |
Property Details
setRejectionEnabled
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Enables the behavior that allows the onReady promise to be rejected if failures are encountered. If not passed, then the onReady promise won't reject.
setRejectionEnabled?: () => void;
Property Value
() => void
Examples
// Enable rejection behavior for the onReady promise.
Office.onReadyOptions?.setRejectionEnabled();
// Now the onReady promise can be rejected if failures are encountered during its setup.
Office.onReady((info) => {
console.log(`Host: ${info.host}, Platform: ${info.platform}`);
}).catch((error) => {
console.error("Office.js initialization failed:", error);
});