1.0.1 • Published 1 year ago

@dev-forms/client v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Dev Forms Client

Official JavaScript/TypeScript client for the Dev Forms API.

Installation

# Using npm
npm install @dev-forms/client

# Using Bun
bun add @dev-forms/client

Usage

import DevForms from '@dev-forms/client';

// Initialize with single access key
const client = new DevForms('your-access-key');

// Or with multiple access keys
const client2 = new DevForms(['key1', 'key2']);

// Submit form data
await client.submit({
	name: 'John Doe',
	email: 'john@example.com',
	message: 'Hello!',
});

// Submit HTML form
const form = document.querySelector('form');
await client.submitForm(form);

API Reference

Constructor

new DevForms(accessKey: string | string[], config?: { baseUrl?: string })

Methods

submit(formData: object)

Submit form data programmatically.

submitForm(form: HTMLFormElement)

Submit an HTML form directly.

License

MIT

1.0.1

1 year ago

1.0.0

1 year ago