user6833062
user6833062

Reputation: 51

How do I get access to the component Sizes in 'build.after' [Glide.js v 3.1.0]

Not sure how I should use components. I'm not using a modular build.

import Glide from '@glidejs/glide'

var glide = new Glide('.glide')

glide.on('build.after', function() {
  // How do I access the component Sizes and the property slideWidth here?
})

glide.mount()

Upvotes: 2

Views: 1261

Answers (1)

Jędrzej Chałubek
Jędrzej Chałubek

Reputation: 1438

You do not have access to the collection of components in events callbacks. You have to create a custom component instead. More info in documentation.

var Example = function (Glide, Components, Events) {
  return {
    mount () {
      // Here you can access `Sizes` module
      console.log(Components.Sizes)
    }
  }
}

new Glide('.glide').mount({
  'Example': Example
})

Upvotes: 0

Related Questions