Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private async openDisconnectConfirm() {
const alert: HTMLIonAlertElement = await alertController.create({
header: 'Disconnect',
message: 'The remote control must be disconnected from the presentation?',
cssClass: 'custom-info',
buttons: [
{
text: 'No',
role: 'cancel',
handler: () => {
// Nothing
}
}, {
text: 'Yes',
handler: async () => {
await this.disconnect();
}
}
async onSWUpdate() {
const registration = await navigator.serviceWorker.getRegistration();
if (!registration || !registration.waiting) {
// If there is no registration, this is the first service
// worker to be installed. registration.waiting is the one
// waiting to be activiated.
return;
}
const toast = await toastCtrl.create({
message: "New version available",
showCloseButton: true,
closeButtonText: "Reload"
});
await toast.present();
await toast.onWillDismiss();
registration.waiting.postMessage("skipWaiting");
window.location.reload();
}
import './scripts/loading.js';
import './scripts/slider.js';
import './scripts/sliderJumpTo.js';
import './scripts/modalNotes.js';
import './scripts/modalRemoteControl.js';
import './scripts/remoteControl.js';
import './scripts/actions.js';
import './scripts/menu.js';
import './scripts/history.js';
import './scripts/fullscreen.js';
import './scripts/resize.js';
import './scripts/actionPlayPause.js';
import { defineCustomElements as ionicElements } from '@ionic/core/loader';
ionicElements(window);
import { defineCustomElements as ioniconsElements } from 'ionicons/dist/loader';
ioniconsElements(window);
// Init DeckDeckGo elements
import { defineCustomElements as deckDeckGoElements } from '@deckdeckgo/core/dist/loader';
import {defineCustomElements as deckDeckGoSlideTitleElements } from '@deckdeckgo/slide-title/dist/loader';
import {defineCustomElements as deckDeckGoSlideContentElements } from '@deckdeckgo/slide-content/dist/loader';
import {defineCustomElements as deckDeckGoSlideAuthorElements } from '@deckdeckgo/slide-author/dist/loader';
import {defineCustomElements as deckDeckGoSlideChartElements } from '@deckdeckgo/slide-chart/dist/loader';
import {defineCustomElements as deckDeckGoSlideYoutubeElements } from '@deckdeckgo/slide-youtube/dist/loader';
import {defineCustomElements as deckDeckGoSlideSplitElements } from '@deckdeckgo/slide-split/dist/loader';
import {defineCustomElements as deckDeckGoSlideCodeElements } from '@deckdeckgo/slide-code/dist/loader';
import {defineCustomElements as deckDeckGoSlideCountdownElements } from '@deckdeckgo/slide-countdown/dist/loader';
import {defineCustomElements as deckDeckGoSlideGifElements } from '@deckdeckgo/slide-gif/dist/loader';
'arrow-back-sharp': arrowBackSharp,
'chevron-back': chevronBack,
'chevron-forward': chevronForward,
'close-circle': closeCircle,
'close-sharp': closeSharp,
'menu-outline': menuOutline,
'menu-sharp': menuSharp,
'reorder-two-sharp': reorderTwoSharp,
'reorder-three-outline': reorderThreeOutline,
'search-outline': searchOutline,
'search-sharp': searchSharp,
});
// TODO: defineCustomElements() is asyncronous
// We need to use the promise
defineCustomElements(window);
return new Promise(async (resolve) => {
try {
const loading: HTMLIonLoadingElement = await loadingController.create({});
await loading.present();
const firebaseUser: firebase.User = firebase.auth().currentUser;
if (firebaseUser) {
// We need the user token to access the API, therefore delete it here first
await this.apiUserService.delete(this.apiUser.id, this.authUser.token);
// Then delete the user
await this.userService.delete(this.authUser.uid);
// Decks and slides are delete with a cloud function triggered on auth.delete
await firebaseUser.delete();
}
}
// Remove the earlier created Vue component from DOM
removeViewFromDom(_parentElement: HTMLElement, childElement: HTMLVueElement): Promise {
// Destroy the Vue component instance
if (childElement.__vue__) {
childElement.__vue__.$destroy();
}
return Promise.resolve();
}
}
const LIFECYCLES = [
ViewLifecycle.WillEnter,
ViewLifecycle.DidEnter,
ViewLifecycle.WillLeave,
ViewLifecycle.DidLeave,
ViewLifecycle.WillUnload
];
export function bindLifecycleEvents(instance: any, element: HTMLElement) {
LIFECYCLES.forEach(eventName => {
element.addEventListener(eventName, (ev: any) => {
if (typeof instance[eventName] === 'function') {
instance[eventName](ev.detail);
}
});
});
}
// Check Symbol support
// Remove the earlier created Vue component from DOM
removeViewFromDom(_parentElement: HTMLElement, childElement: HTMLVueElement): Promise {
// Destroy the Vue component instance
if (childElement.__vue__) {
childElement.__vue__.$destroy();
}
return Promise.resolve();
}
}
const LIFECYCLES = [
ViewLifecycle.WillEnter,
ViewLifecycle.DidEnter,
ViewLifecycle.WillLeave,
ViewLifecycle.DidLeave,
ViewLifecycle.WillUnload
];
export function bindLifecycleEvents(instance: any, element: HTMLElement) {
LIFECYCLES.forEach(eventName => {
element.addEventListener(eventName, (ev: any) => {
if (typeof instance[eventName] === 'function') {
instance[eventName](ev.detail);
}
});
});
}
// Check Symbol support
const hasSymbol = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
});
}
// Remove the earlier created Vue component from DOM
removeViewFromDom(_parentElement: HTMLElement, childElement: HTMLVueElement): Promise {
// Destroy the Vue component instance
if (childElement.__vue__) {
childElement.__vue__.$destroy();
}
return Promise.resolve();
}
}
const LIFECYCLES = [
ViewLifecycle.WillEnter,
ViewLifecycle.DidEnter,
ViewLifecycle.WillLeave,
ViewLifecycle.DidLeave,
ViewLifecycle.WillUnload
];
export function bindLifecycleEvents(instance: any, element: HTMLElement) {
LIFECYCLES.forEach(eventName => {
element.addEventListener(eventName, (ev: any) => {
if (typeof instance[eventName] === 'function') {
instance[eventName](ev.detail);
}
});
});
}
// Remove the earlier created Vue component from DOM
removeViewFromDom(_parentElement: HTMLElement, childElement: HTMLVueElement): Promise {
// Destroy the Vue component instance
if (childElement.__vue__) {
childElement.__vue__.$destroy();
}
return Promise.resolve();
}
}
const LIFECYCLES = [
ViewLifecycle.WillEnter,
ViewLifecycle.DidEnter,
ViewLifecycle.WillLeave,
ViewLifecycle.DidLeave,
ViewLifecycle.WillUnload
];
export function bindLifecycleEvents(instance: any, element: HTMLElement) {
LIFECYCLES.forEach(eventName => {
element.addEventListener(eventName, (ev: any) => {
if (typeof instance[eventName] === 'function') {
instance[eventName](ev.detail);
}
});
});
}
// Check Symbol support
const hasSymbol = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
removeViewFromDom(_parentElement: HTMLElement, childElement: HTMLVueElement): Promise {
// Destroy the Vue component instance
if (childElement.__vue__) {
childElement.__vue__.$destroy();
}
return Promise.resolve();
}
}
const LIFECYCLES = [
ViewLifecycle.WillEnter,
ViewLifecycle.DidEnter,
ViewLifecycle.WillLeave,
ViewLifecycle.DidLeave,
ViewLifecycle.WillUnload
];
export function bindLifecycleEvents(instance: any, element: HTMLElement) {
LIFECYCLES.forEach(eventName => {
element.addEventListener(eventName, (ev: any) => {
if (typeof instance[eventName] === 'function') {
instance[eventName](ev.detail);
}
});
});
}
// Check Symbol support
const hasSymbol = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
// Check if object is an ES module