Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

nuxt-contrib/tappable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CircleCI Codecov npm

Tappable

Tapable with promise support.

🛑 Deprecated: please use hookable

Setup

yarn add tappable
# or
npm install --save tappable
// Require module
const Tapable = require('tappable')

Usage

For basic usage please see tapable docs.

applyPlugins*

This functions are wrapped with pify and return promise too.

// Using async/await
await this.applyPluginsAsync('init')

// Using Promise
this.applyPluginsAsync('init')
.then(() => {
  // Applied
})
.catch(err => {
  // Some error happened
})

plugin(names, handler)

When register plugins handler function can also return promise instead of calling callback argument.

webpack.plugin('init', async () => {
  // You can use async/await here  
})

// or
webpack.plugin('init', () => new Promise((resolve, reject) => {
  // Call resolve() or rejcet() when finished or chain promise
}))

License

MIT