Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

grunt.event


May 25, 2021 Grunt



grunt.event

Only the most important methods are listed on this page, and the complete EventEmitter2 API grunt.event object. T he event namespace can use . . (English period) is separated, and you can use namespace wildcards.

Note: Grunt doesn't issue any events at this time, but it's still useful in your own task.

grunt.event.on

Add a listener to the specified event and put the listener down at the end of the listener array.

grunt.event.on(event, listener)

grunt.event.once

Add a listener that executes once for the specified event. The secondary listener is called only after the event is triggered for the first time, and is removed after execution.

grunt.event.once(event, listener)

grunt.event.many

Add a listener to the specified event and execute n times before it is removed.

grunt.event.many(event, timesToListen, listener)

grunt.event.off

Remove all listeners that listen to a specified event from the listener array.

grunt.event.off(event, listener)

grunt.event.removeAllListeners

Remove all listeners, or all listeners for a specified event.

grunt.event.removeAllListeners([event])

grunt.event.emit

Each listener that might listen to this event name is executed in turn, and the list of parameters is passed to each event listener.

grunt.event.emit(event, [arg1], [arg2], [...])