This is a demonstration project created for educational and portfolio purposes to showcase technical skills including API integration, rate limiting implementation, Chrome extension development, and real-time DOM manipulation. This project is not intended for production use or distribution.
A Chrome extension that demonstrates integration with Motion's REST API to enhance task visualization. The extension adds dynamic due date indicators to Motion tasks and implements sophisticated rate limiting.
class RateLimiter {
constructor(maxRequests, perMinutes = 1) {
this.maxRequests = maxRequests;
this.perMinutes = perMinutes;
this.requests = [];
}
async waitForAvailableSlot() {
const now = Date.now();
const windowMs = this.perMinutes * 60 * 1000;
this.requests = this.requests.filter(time => now - time < windowMs);
}
}The rate limiter uses a sliding window algorithm to ensure compliance with API limits while maximizing throughput. This implementation:
- Tracks request timestamps in a rolling window
- Automatically queues requests when approaching limits
- Provides built-in request retry functionality
function setupTaskObserver(tasksData) {
const observer = new MutationObserver((mutations) => {
mutations.forEach(mutation => {
mutation.addedNodes.forEach(node => {
if (node.nodeType === Node.ELEMENT_NODE) {
if (node.matches('[data-event-id^="task|"]')) {
processTaskElement(node, tasksData);
}
}
});
});
});
}The MutationObserver implementation handles:
- Dynamic content loading
- Task updates in real-time
- Efficient DOM manipulation
- Clone this repository:
git clone https://github.com/yourusername/motion-task-extension.git- Open Chrome and navigate to:
chrome://extensions/
-
Enable "Developer mode" in the top right corner
-
Click "Load unpacked" and select the cloned repository folder
-
Configure the extension:
- Click the extension icon
- Select "Options"
- Enter a Motion API key (requires a Motion account)
- Navigate to Motion's web application
- The extension will automatically:
- Fetch workspace and task data
- Add due date indicators to tasks
- Update dynamically as you interact with tasks
- Tasks should display color-coded due date indicators
- Due dates update automatically
- Rate limiting ensures smooth API interaction
The extension interacts with several Motion API endpoints:
/workspaces- Fetches available workspaces/tasks- Retrieves task data with pagination- Handles API responses with comprehensive error checking
async function processTaskElement(taskElement, tasksData) {
const taskInfo = extractTaskInfo(taskElement);
const matchingTask = findMatchingTask(taskInfo, tasksData);
if (matchingTask && matchingTask.dueDate) {
addDaysUntilDue(taskElement, matchingTask.dueDate);
}
}Tasks are processed through multiple stages:
- Information extraction from DOM
- Matching with API data
- Visual enhancement application
- Implementing a sliding window algorithm
- Balancing performance with API compliance
- Handling edge cases in request timing
- Efficient event handling
- Managing dynamic content updates
- Preventing memory leaks
- Handling pagination effectively
- Error recovery strategies
- Data synchronization patterns
This is a feature demo using a segment of my own calendar!
motion-task-extension/
├── manifest.json # Extension configuration
├── content.js # Main functionality
└── options.html # API key configuration
- JavaScript (ES6+)
- Chrome Extension APIs
- Motion REST API
- MutationObserver API
- Chrome Storage API
This project is for demonstration purposes only. Not for commercial use or distribution.
Created by Cassandra Coppo for technical demonstration and portfolio purposes.

