C
C
coderlex2015-11-15 17:40:01
JavaScript
coderlex, 2015-11-15 17:40:01

Is it possible to connect a module from a function according to ES6?

Does this connection of modules comply with the standard:

welcome() {
  import Userbar from 'views/Userbar'
  import Welcome from'views/layouts/Welcome'
  import Footer from 'views/Footer'

  this.setViews([
    new Userbar({docked: false}),
    new Welcome(),
    new Footer(),
  ])
},

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aves, 2015-11-15
@coderlex

No, unlike modules like CommonJS, imports in ES2015 are static and happen before the code starts executing.
Actually, even Babel does not chew this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question