Setup
1. Find an extension.
For this guide, we will use a custom function. You can find one on your own, or use our Extension Finder.
(db) => {
if(!db) throw new Error("This extension requires database permissions")
db.create('hello', `Hello, World!`)
}
2. Define permissons
const { extensionPermissions } = require('dubnium')
const permissions = new extensionPermissions(true, false, [ 'edit' ])
Parameter
About
Required
record
Allow access to the Record when extending the record editor API
database
Allow access to the entire database when extending the database.
filterList
An array of function names to omit from an extension.
3. Add to Dubnium
db.extend('name', require('./extension'), permissions)
db.get('tag').extend('name', require('./extension'), permissions)
4. Use the extension
db.name()
Full Example
db.extend('createHelloWorld', (db) => {
if(!db) throw new Error("This extension requires database permissions")
db.create('hello', `Hello, World!`)
}, new extensionPermissions(false, true))
db.createHelloWorld()
Last updated
Was this helpful?