
Product
Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
choo-trigger
Advanced tools
Set up an event to be emitter after another event has been emitted. This allows
you to chain events in series from a view to create ad-hoc workflows for your
application. Triggers are attached via .once
so after they are fired, they are
removed from the emitter.
emit('trigger:create', opts:object(key:string))
Create a listener using .once
for a specific event, and then fire an event
in response to it.
opts
:
on:string
- event name to listen forevent:string
- event name to firedata:any
- data to include with the event being emittedvar choo = require('choo')
var trigger = require('choo-trigger')
var app = choo()
app.use(trigger)
app.use(store)
app.route('/', main)
document.body.appendChild(app.start())
function store (state, emitter) {
state = {
trigger: false,
hello: 'no one'
}
emitter.on('runTrigger', (opts) => {
state.trigger = true
state.hello = opts.hello
emitter.emit('render')
})
}
function main (state, emit) {
emit('trigger:create', {on: 'go', event: 'runTrigger', data: {hello: 'world'}})
return html`<div>
triggered? ${state.trigger}<br>
hello, ${state.hello}
<button onclick=${run}>send trigger!</button>
</div>`
function run (evt) {
evt.preventDefault()
emit('go')
}
}
Copyright © 2017 Todd Kennedy, Apache-2.0 Licensed
FAQs
Chain emitters together
The npm package choo-trigger receives a total of 2 weekly downloads. As such, choo-trigger popularity was classified as not popular.
We found that choo-trigger demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.