Skip to content

Commit cb3146b

Browse files
committed
Merge changes from Office-Addin-TaskPane
2 parents 98c9181 + ddba44c commit cb3146b

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

src/commands/commands.ts

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,29 @@
33
* See LICENSE in the project root for license information.
44
*/
55

6-
(() => {
7-
// The initialize function must be run each time a new page is loaded
8-
Office.initialize = () => {
6+
Office.onReady(info => {
7+
// If needed, Office.js is ready to be called
8+
});
99

10-
};
10+
/**
11+
* Shows a notification when the add-in command is executed.
12+
* @param event
13+
*/
14+
function action(event: Office.AddinCommands.Event) {
15+
// Your code goes here
16+
17+
// Be sure to indicate when the add-in command function is complete
18+
event.completed();
19+
}
20+
21+
function getGlobal() {
22+
return (typeof self !== "undefined") ? self :
23+
(typeof window !== "undefined") ? window :
24+
(typeof global !== "undefined") ? global :
25+
undefined;
26+
}
27+
28+
const g = getGlobal() as any;
1129

12-
// Add any ui-less function here
13-
})();
30+
// the add-in command functions need to be available in global scope
31+
g.action = action;

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ module.exports = async (env, options) => {
7777
"Access-Control-Allow-Origin": "*"
7878
},
7979
https: await devCerts.getHttpsServerOptions(),
80-
port: 3000
80+
port: 3000,
8181
}
8282
};
8383

0 commit comments

Comments
 (0)