
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Bara is a library created for creating any (front/back/cli) JavaScript application.
npm install --save bara
or
yarn add bara
const {
register,
useStream,
useTrigger,
useEvent,
useCondition,
useAction,
createEventType
} = require('bara')
const ON_TIME_ESLAPSED = createEventType('ON_TIME_ESLAPSED')
const EVERY_X_SECOND = x => second => second % x === 0
const ONLY_EVEN_SECOND = EVERY_X_SECOND(2)
const app = () => {
// Register source stream factory for Bara application
useStream(({setName, addEventType, emit}) => {
setName('dev.barajs.timer')
let elapsed = 0;
const timer = setInterval(() => {
emit(ON_TIME_ESLAPSED, elapsed++);
}, 1000);
return () => {
// Cleanup when zero listener
clearInterval(timer)
}
})
// Register a trigger that will be triggered every even second
useTrigger(() => {
const event = useEvent(ON_TIME_ESLAPSED)
const condition = useCondition(ONLY_EVEN_SECOND)
const action = useAction((second) => {
console.log(`Tik every even seconds: ${second}`)
})
return {event, condition, action}
})
// Register a trigger that will be triggered every 5 second
useTrigger(() => {
const every = 5
const event = useEvent(ON_TIME_ELAPSED)
const condition = useCondition(EVERY_X_SECOND(every))
const action = useAction((second) => {
console.log(`Tik every `${every}` seconds: ${second}`)
})
return {event, condition, action}
})
}
register(app);
FAQs
Created For Creating - Create any JavaScript application.
We found that bara 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 Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.