Skip to content

Instantly share code, notes, and snippets.

View Oaphi's full-sized avatar
💭
☕ and 👩‍💻

Oleg Valter Oaphi

💭
☕ and 👩‍💻
  • Cursiver
  • Saint Petersburg
View GitHub Profile
@Oaphi
Oaphi / PropertyLockService.js
Created August 7, 2020 13:06
PropertyLockService
var PropertyLock = (() => {
let locked = false;
let timeout = 0;
const store = PropertiesService.getScriptProperties();
const propertyName = "locked";
const triggerName = "PropertyLock.releaseLock";
@Oaphi
Oaphi / WebAppSelfHelp.md
Last active November 22, 2022 18:48
Web App troubleshooting questionnaire

Preliminary

  1. Does the Web App have a saved deployment? ("Publish" -> "Deploy as Web App")
  2. Are you accessing the /dev endpoint (https://script.google.com/.../yourIdHere/dev)?
  3. If you are accessing the /exec endpoint (https://script.google.com/.../yourIdHere/exec), did you redeploy?
  4. If you redeployed, did you increment the script version?
  5. If you have a client-side problem, what does the console say (pres F12 to open developer tools)?
  6. If you have a server-side problem, what do executions say (https://script.google.com/home/projects/yourIdHere/executions

Web App Access

@Oaphi
Oaphi / asyncGAPI.js
Last active February 24, 2021 15:27
Async-friendly google.script.run utility
/**
* Promise-friendly google.script.run call
* @param {String} funcName
* @param {...*} params
* @returns {Promise}
*/
const asyncGAPI = (funcName, ...params) => {
return new Promise((res, rej) => {
google.script.run
.withSuccessHandler(data => res(data))