Types declaration file for Widget -> UI events payload.
npm install codyfight-widget-ui-typeTypes declaration file for Widget -> UI events payload.
https://www.npmjs.com/package/codyfight-widget-ui-type
This package can be installed via npm or yarn:
``bash`
npm install codyfight-widget-ui-type --save-dev
or
`bash`
yarn add codyfight-widget-ui-type -D
`typescript
import type { GameConfigEvent, GameState } from "codyfight-widget-ui-type";
// Example usage of exported types
function handleGameState(event: GameState) {
// Do something with event.detail.value
}
function handleGameConfig(event: GameConfigEvent) {
// Do something with event.detail.value.toggleSound
}
`
In order to update the types, follow these steps:
1. Clone the repository
2. Run npm installsrc/index.ts
3. Update the filepackage.json
4. Update the package version in npm run build
5. Run npm publish
6. Run
7. Commit and push the changes
Make sure to log in to npm before publishing the package:
`bash`
npm login
Make sure to always have the latest version of the package installed in your project:
`json`
{
"devDependencies": {
"codyfight-widget-ui-type": "^1.0.0"
}
}
`bash`
yarn upgrade codyfight-widget-ui-type --latest
or
`bash``
npm update codyfight-widget-ui-type --latest