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

Object no longer usable / sound is not a function #96

Open
tvld opened this issue Feb 28, 2019 · 1 comment
Open

Object no longer usable / sound is not a function #96

tvld opened this issue Feb 28, 2019 · 1 comment

Comments

@tvld
Copy link

tvld commented Feb 28, 2019

Browser is logging ion_sound__WEBPACK_IMPORTED_MODULE_7___default.a.sound is not a function:

import ion from 'ion-sound'
ion.sound({
  sounds: [
    {
      name: 'alarm_bell',
      volume: 1.0,
      loop: true
    }
    // {
    //   name: 'notify_sound',
    // }
  ],
  volume: 0.5,
  path: '/sound/',
  preload: true
})

Any idea why this is ?

@masterT
Copy link

masterT commented May 19, 2020

If you look at the source code when you import 'ion-sound' it will get attached to the window. The following code should work.

-import ion from 'ion-sound'
+import 'ion-sound'
-ion.sound({
+window.ion.sound({
  sounds: [
    {
      name: 'alarm_bell',
      volume: 1.0,
      loop: true
    }
    // {
    //   name: 'notify_sound',
    // }
  ],
  volume: 0.5,
  path: '/sound/',
  preload: true
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants