Skip to content

Add startup state #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion addins/upgrade/upgrade_appcmd.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 App Commands</title>

<script src="https://unpkg.com/@microsoft/[email protected].28/dist/office.debug.js" type="text/javascript"></script>
<script src="https://unpkg.com/@microsoft/[email protected].32/dist/office.debug.js" type="text/javascript"></script>
<script src="upgrade.js" type="text/javascript"></script>

<script type="text/javascript">
Expand Down
36 changes: 34 additions & 2 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/[email protected].28/dist/office.debug.js" type="text/javascript"></script>
<script src="https://unpkg.com/@microsoft/[email protected].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() {
var startupState = document.getElementById("setStartupStateValue").value;
OfficeRuntime.currentRuntime.setStartupState(startupState);
}

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

function getCurrentStatValueIntoUI() {
var currentState = OfficeRuntime.currentRuntime.getState();
document.getElementById("getCurrentStateValue").innerText = currentState;
}
</script>
</head>
<body>
Expand All @@ -39,6 +54,23 @@ <h1>Upgrade Shared Runtime</h1>
&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>