Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions addins/upgrade/upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ function setRuntimeState(value) {
return OfficeRuntime.currentRuntime.setState(value);
}

function getStartupState() {
return OfficeRuntime.currentRuntime.getStartupState();
}

function setStartupState(value) {
return OfficeRuntime.currentRuntime.setStartupState(value);
}

CustomFunctions.associate('VERSIONSYNC', getVersion);
CustomFunctions.associate('VERSIONASYNC', getVersion);
CustomFunctions.associate('VERSIONDELAYED', function(ms) { return delay(getVersion, ms); });
Expand All @@ -66,3 +74,6 @@ CustomFunctions.associate('SETSHAREDVALUE', setSharedValue);

CustomFunctions.associate('GETRUNTIMESTATE', getRuntimeState);
CustomFunctions.associate('SETRUNTIMESTATE', setRuntimeState);

CustomFunctions.associate('GETSTARTUPSTATE', getStartupState);
CustomFunctions.associate('SETSTARTUPSTATE', setStartupState);
33 changes: 33 additions & 0 deletions addins/upgrade/upgrade.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,39 @@
"options": {
"sync": false
}
},

{
"id": "GETSTARTUPSTATE",
"name": "GETSTARTUPSTATE",
"result": {
"type": "string",
"dimensionality": "scalar"
},
"parameters": [
],
"options": {
"sync": false
}
},

{
"id": "SETSTARTUPSTATE",
"name": "SETSTARTUPSTATE",
"result": {
"type": "string",
"dimensionality": "scalar"
},
"parameters": [
{
"name": "value",
"type": "string",
"dimensionality": "scalar"
}
],
"options": {
"sync": false
}
}

]
Expand Down
38 changes: 35 additions & 3 deletions addins/upgrade/upgrade_shared.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta http-equiv="Expires" content="0" />
<title>Upgrade Shared Runtime</title>

<script src="https://unpkg.com/@microsoft/office-js@1.1.33-custom.28/dist/office.debug.js" type="text/javascript"></script>
<script src="https://unpkg.com/@microsoft/office-js@1.1.33-custom.32/dist/office.debug.js" type="text/javascript"></script>
<script src="upgrade.js" type="text/javascript"></script>

<script type="text/javascript">
Expand All @@ -26,6 +26,21 @@
function getSharedValueIntoUI() {
document.getElementById("getValue").innerText = g_sharedState.value;
}

function setStartupStateValueFromUI() {
const startupState = document.getElementById("setStartupStateValue").value;
OfficeRuntime.currentRuntime.setStartupState(startupState);
}

function getStartupStateValueIntoUI() {
const startupState = OfficeRuntime.currentRuntime.getStartupState();
document.getElementById("getCurrentStateValue").innerText = startupState;
}

function getCurrentStatValueIntoUI() {
const currentState = OfficeRuntime.currentRuntime.getState();
document.getElementById("getCurrentStateValue").innerText = currentState;
}
</script>
</head>
<body>
Expand All @@ -34,11 +49,28 @@ <h1>Upgrade Shared Runtime</h1>
&nbsp;
<input type="text" id="setValue" />
<br />

<input type="button" id="getButton" value="Get Shared Value" onclick="javascript: getSharedValueIntoUI();" />
&nbsp;
<span id="getValue"></span>
<br />

<br />

<input type="button" id="setStartupStateButton" value="Set Startup State" onclick="javascript: setStartupStateValueFromUI();" />
&nbsp;
<input type="text" id="setStartupStateValue" />
<br />

<input type="button" id="getStartupStateButton" value="Get Startup State" onclick="javascript: getStartupStateValueIntoUI();" />
&nbsp;
<span id="getStartupStateValue"></span>
<br />
<br />

<input type="button" id="getCurrentStateButton" value="Get Current State" onclick="javascript: getCurrentStatValueIntoUI();" />
&nbsp;
<span id="getCurrentStateValue"></span>
<br />

</body>
</html>