Get started with documentup CDN

MIT licensed

DocumentUP is a lightweight library that enables automatic scrolling to specific content as users scroll down a webpage.

Tags:
  • documentup

Stable version

Copied!

How to start using documentup CDN


// Include the documentup library
const Documentup = require('documentup/dist/documentup.min.js');

// Initialize Documentup with your API key
const documentup = new Documentup('YOUR_API_KEY');

// Define a function to upload a document
async function uploadDocument(file) {
  try {
    const uploadedDocument = await documentup.upload(file);
    console.log('Document uploaded:', uploadedDocument.id);
  } catch (error) {
    console.error('Error uploading document:', error.message);
  }
}

// Use the function to upload a file
const fileInput = document.querySelector('#file-input');
fileInput.addEventListener('change', async () => {
  const file = fileInput.files[0];
  await uploadDocument(file);
});
Copied!
Copied!

All versions