Reputation: 1899
I created a gist on Github where I'm using some Preview functions in OfficeJS to address the Settings in a Word document. Gist to Preview Settings options in OfficeJS
To avoid issues when running in a non preview environment you need to "check" if the Api Level meets the Preview requirements
// How to test for isSetSupported isSetSupported("WordApi", "Preview") ??
if (_requirements.isSetSupported("WordApi", "1.3")) {
Testing for isSupported however does not accept the "Preview" option.
So the question (see gist link above) is how to test for the Preview status to avoid running preview functions like the Settings options in the Gist the way it is done in the Gist code (snippet above).
Upvotes: 0
Views: 140
Reputation: 121
To use the Preview APIs, you need to reference beta library https://appsforoffice.microsoft.com/lib/beta/hosted/office.js instead of the production library. That's only for test purpose. The official add-in should not use beta library, so there is no API to check if the env support preview or not.
Upvotes: 1