1.0.2 • Published 3 years ago
firebase-async-trigger v1.0.2
Usage
Add dependency
npm install --save firebase-async-trigger
npm install --save @types/firebase-async-trigger
Import the package
Add the code to your index.ts
import { getTriggerCloudFunction } from 'firebase-async-trigger'
Export the trigger
Add the code to your index.ts
const handlers = new Map<string, (params: Map<string, string>) => Promise<void>>()
//set whatever handler functions to the map
handlers.set("trigger-name", async function(params: Map<string, string>) {
console.log(params)
})
const trigger = getTriggerCloudFunction({
"handlers": handlers,
//as admin is already initialized, this will get the initialized app
adminApp: admin.apps[0],
slackUrl: "your_slack_trigger_url"
})
export { trigger }
Develop
Build
npm run build
Run tests
npm run tests
Run tests with coverage
npm run coverage