Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript Notification API throws an error upon invokation #2330

Closed
elvinaspredkelis opened this issue Jul 31, 2021 · 0 comments
Closed

Javascript Notification API throws an error upon invokation #2330

elvinaspredkelis opened this issue Jul 31, 2021 · 0 comments

Comments

@elvinaspredkelis
Copy link
Contributor

Describe the bug

JS API for notifications throw an error upon invokation:

Unhandled Promise Rejection: TypeError: undefined is not a function (near '...window.__TAURI__.invoke...')

To Reproduce

Steps to reproduce the behavior:

  1. Install Tauri via Vue CLI
  2. Try to invoke any of the notification module methods via the JS API

Expected behavior

Default behavior for notification invokation.

Platform and Versions (required):

Operating System - Mac OS, version 11.2.3 X64

Node.js environment
  Node.js - 15.2.0
  @tauri-apps/cli - 1.0.0-beta.6
  @tauri-apps/api - 1.0.0-beta.5

Global packages
  npm - 6.14.9
  yarn - 1.22.10

Rust environment
  rustc - 1.51.0
  cargo - 1.51.0

App directory structure
/node_modules
/public
/src-tauri
/src

App
  tauri.rs - 1.0.0-beta.5
  build-type - bundle
  CSP - default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'
  distDir - Set automatically by Vue CLI plugin
  devPath - Set automatically by Vue CLI plugin
  framework - Vue.js (Vue CLI)
  bundler - Webpack

Additional context

Exact dummy snippet throwing an error, borrowed from the example repositories:

if (Notification.permission == "default") {
        Notification.requestPermission().then((response) => {
            if (response === "granted") {
              console.log("OK")
            } else {
              console.log("Permission is " + response);
            }
          })
      }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant