-
Notifications
You must be signed in to change notification settings - Fork 0
Home
To install the Revolutionary Games Common Foundry VTT Library in your project, run:
npm install @revolutionarygamesco/common-foundryvtt --saveYou can then add methods from the library and call them like this:
import { generateID } from '@revolutionarygamesco/common-foundryvtt'
const id = generateID() // A random, 16-digit alphanumeric stringThis library provides Typescript types for Foundry VTT (verified as of v14), which makes it incompatible with other attempts to provide such types, like fvtt-types.
If you import any methods from this library, it will add all of the types to your global namespace (under foundry., e.g., foundry.documents.JournalEntry). If you just want the types but don’t have any use for any other methods, you can include them by adding this to any file in your project:
import '@revolutionarygamesco/common-foundryvtt'This library ships mocks for Vitest that cover some of Foundry’s methods and objects (including game and foundry). Add it to your vitest.config.ts like so:
import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
setupFiles: ['@revolutionarygamesco/common-foundryvtt/mocks/setup'],
unstubGlobals: true
}
})- findFolder
- generateApplicationPosition
- getClickedDocument
- getDroppedDocument
- generateID
- getID
- getPronouns
- loadDocument
- makeLink