Skip to main content

bud.provide

bud.provide makes a variable or module available throughout the entire application.

Usage

To specify that $ is the default jquery export:

bud.provide({
jquery: '$',
})

Now, in any module in our application, the jquery module can be referenced using $. There is no need to import it.

$(`#modal`) // it just works

If you have have more than one token referring to the same module, use an array:

bud.provide({
jquery: ['$', 'jQuery'],
})

If preferred you can call it with two parameters. The first parameter is the accessor (how you want to reference it). The second parameter is the value (the module or value you want to reference):

bud.provide(`jquery`, [`jQuery`, `$`])