How to use the @ionic/core.toastController.create function in @ionic/core

To help you get started, we’ve selected a few @ionic/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jgw96 / web-whiteboard / src / components / app-root / app-root.tsx View on Github external
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();
  }
github jgw96 / web-whiteboard / src / components / app-controls / app-controls.tsx View on Github external
async openColorVision() {
    const modal = await modalCtrl.create({
      component: 'color-modal'
    });
    await modal.present();

    const colorData = await modal.onDidDismiss();

    console.log(colorData.data);

    if (colorData.data && colorData.data.length > 0) {
      this.selectColor(`#${colorData.data}`);

      const toast = await toastCtrl.create({
        message: `Found this color: #${colorData.data}`,
        duration: 1200,
        position: "top",
      });
      await toast.present();
    }
  }
github jgw96 / web-whiteboard / src / components / app-controls / app-controls.tsx View on Github external
async erase() {
    ga('send', 'event', ['Button'], ['Erase'], ['Erasing']);

    if (!this.erasing) {
      this.eraserMode.emit();
      this.erasing = true;

      const eraseToast = await toastCtrl.create({
        message: 'erase mode',
        duration: 1300,
        position: 'top'
      });
      await eraseToast.present();
    }
    else {
      this.erasing = false;
      this.penMode.emit();

      const penToast = await toastCtrl.create({
        message: 'pen mode',
        duration: 1300,
        position: 'top'
      });
      await penToast.present();
github jgw96 / web-whiteboard / src / components / app-home / app-home.tsx View on Github external
console.log(appCanvas);
              await appCanvas.saveCanvas(data.fileName);

              console.log(data);

              this.currentFileName = data.fileName;
            }
          }
        ]
      });
      await alert.present();
    }
    else if (this.currentFileName) {
      await appCanvas.saveCanvas(this.currentFileName);

      const toast = await toastController.create({
        message: `${this.currentFileName} saved`,
        duration: 1800
      });
      await toast.present();
    }
  }
github jgw96 / web-whiteboard / src / components / app-images / app-images.tsx View on Github external
/*let remoteImages = [];

                this.images.forEach((image) => {
                  if (image.id) {
                    remoteImages.push({ id: image.id, name: image.name });
                  }
                });

                saveImages(remoteImages);*/

                await saveImagesS(this.images);

                await loading.dismiss();

                const toast = await toastCtrl.create({
                  message: "Board uploaded to OneDrive",
                  duration: 1800
                });
                await toast.present();
              }
              catch (err) {
                console.error(err);

                const toast = await toastCtrl.create({
                  message: "Upload failed, try again later",
                  duration: 1800
                });
                await toast.present();
              }
            }
          }
github deckgo / deckdeckgo / studio / src / app / app-root.tsx View on Github external
private async toastError(error: string) {
        const popover: HTMLIonToastElement = await toastController.create({
            message: error,
            showCloseButton: true,
            position: 'top',
            color: 'danger',
            duration: 6000
        });

        await popover.present();
    }
github jgw96 / web-whiteboard / src / components / app-images / app-images.tsx View on Github external
let imageToDelete = null;

    this.images.forEach((image) => {
      if (image.name === imagePicked.name) {
        imageToDelete = image;
      }
    });

    if (imageToDelete !== null) {
      const indexOfImage = this.images.indexOf(imageToDelete);

      if (indexOfImage > -1) {
        this.images.splice(indexOfImage, 1);

        const toast = await toastCtrl.create({
          message: "deleting image",
          duration: 1300
        });
        await toast.present();

        this.images = [...this.images];

        await set('images', this.images);
        await saveImagesS(this.images);
      }
    }

    event.preventDefault();
  }