Sha256: 04578f48502f9b463490d36bc5b16be60ff94bf929ef676c47195e0ff6785950

Contents?: true

Size: 1.26 KB

Versions: 57

Compression:

Stored size: 1.26 KB

Contents

import setSheetParameters from './simpleSetSheetParameters.js';
import createAlertsHtml from './createAlertsHtml.js';

const SHEET_KEY = '1plXBiZY5pVbhNT-mszxEuqCl4zy8wMnz9gXXbbT_yLs';
const SHEET_TAB_NAME = 'Alerts';
const EMERGENCY_ALERT_DIV_ID = 'emergencyAlerts'

function start() {
  if ( ! document.getElementById(EMERGENCY_ALERT_DIV_ID) )
    return;

  //var t0 = performance.now();
  init();
  //var t1 = performance.now();
  //console.info("Call to 'init' took " + (t1 - t0) + " milliseconds.");
}

function init() {
  const params = {
    'apiKey': 'AIzaSyCEBsbXfFcdbkASlg-PodD1rT_Fe3Nw62A',
    'discoveryDocs': ['https://www.googleapis.com/discovery/v1/apis/sheets/v4/rest']
  };
  const sheetParams = setSheetParameters(SHEET_KEY, SHEET_TAB_NAME);

  gapi.client.init(params).then(function() { // Executes an API request, and returns a Promise.
    function execute() {
      return gapi.client.sheets.spreadsheets.values.get(sheetParams)
        .then(function(response) {
          createAlertsHtml(response);
        },
        function(err) {
          console.error("Execute error", err);
        });
    }
    execute();
  });
}
// Loads the JavaScript client library and invokes `start` afterwards.
//    Usage:
//  gapi.load('client', start);
export default start;

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
kcc-gem-theme-1.67.69 assets/js/theme/alerts/campusAlertsSheetsAPI.js
kcc-gem-theme-1.67.68 assets/js/theme/alerts/campusAlertsSheetsAPI.js
kcc-gem-theme-1.66.68 assets/js/theme/alerts/campusAlertsSheetsAPI.js
kcc-gem-theme-1.66.67 assets/js/theme/alerts/campusAlertsSheetsAPI.js
kcc-gem-theme-1.66.66 assets/js/theme/alerts/campusAlertsSheetsAPI.js
kcc-gem-theme-1.66.65 assets/js/theme/alerts/campusAlertsSheetsAPI.js
kcc-gem-theme-1.66.64 assets/js/theme/alerts/campusAlertsSheetsAPI.js
kcc-gem-theme-1.66.63 assets/js/theme/alerts/campusAlertsSheetsAPI.js
kcc-gem-theme-1.66.62 assets/js/theme/alerts/campusAlertsSheetsAPI.js
kcc-gem-theme-1.65.62 assets/js/theme/alerts/campusAlertsSheetsAPI.js
kcc-gem-theme-1.65.61 assets/js/theme/alerts/campusAlertsSheetsAPI.js
kcc-gem-theme-1.65.60 assets/js/theme/alerts/campusAlertsSheetsAPI.js
kcc-gem-theme-1.65.59 assets/js/theme/alerts/campusAlertsSheetsAPI.js
kcc-gem-theme-1.65.58 assets/js/theme/alerts/campusAlertsSheetsAPI.js
kcc-gem-theme-1.65.57 assets/js/theme/alerts/campusAlertsSheetsAPI.js
kcc-gem-theme-1.65.56 assets/js/theme/alerts/campusAlertsSheetsAPI.js
kcc-gem-theme-1.65.55 assets/js/theme/alerts/campusAlertsSheetsAPI.js
kcc-gem-theme-1.65.54 assets/js/theme/alerts/campusAlertsSheetsAPI.js
kcc-gem-theme-1.65.53 assets/js/theme/alerts/campusAlertsSheetsAPI.js
kcc-gem-theme-1.65.52 assets/js/theme/alerts/campusAlertsSheetsAPI.js