Feature: Support closing dialog windows (#233)

Supports closing dialogs in development. Upgrades gas-client to 1.2.0 and uses new API here: Add scriptHostFunctions for google.script.host gas-client#36
Example button to close dialog in Bootstrap sample
Updates integration tests
This commit is contained in:
Elisha Nuchi
2025-03-16 12:13:30 -04:00
committed by GitHub
parent 85223ca42a
commit 248a90023c
17 changed files with 2494 additions and 2502 deletions
+8 -2
View File
@@ -309,8 +309,8 @@ google.script.run
.addSheet(sheetTitle);
// Using gas-client we can use more familiar promises style like this:
import Server from 'gas-client';
const { serverFunctions } = new Server();
import { GASClient } from 'gas-client';
const { serverFunctions, scriptHostFunctions } = new GASClient({});
// We now have access to all our server functions, which return promises!
serverFunctions
@@ -327,6 +327,12 @@ async () => {
handleError(err);
}
};
// Use scriptHostFunctions to control dialogs
scriptHostFunctions.close(); // close a dialog or sidebar
scriptHostFunctions.setWidth(400); // set dialog width to 400px
scriptHostFunctions.setHeight(800); // set dialog height to 800px
```
In development, `gas-client` will allow you to call server-side functions from your local environment. In production, it will use Google's underlying `google.script.run` utility.