Package Exports
- @airgram/constants
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@airgram/constants) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
TDLib constants
This repository contains TDLib (1.4.0) types directory.
Installation
# npm
npm install @airgram/constantsBasic usage
import { UPDATE } from '@airgram/constants'
function handleUpdate (update) {
switch (update._) {
case UPDATE.updateAuthorizationState:
// ...
break
case UPDATE.updateNewMessage:
// ...
break
case UPDATE.updateNewChat:
// ...
break
}
}Using in airgram middleware:
import { UPDATE } from '@airgram/constants'
import { Airgram } from 'airgram'
const airgram = new Airgram({
// config
})
airgram.on(UPDATE.updateUser, async ({ update }) => {
console.log('[new user]:', update)
})License
The source code is licensed under GPL v3. License is available here.