Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@doist/todoist-quickadd

Package Overview
Dependencies
Maintainers
4
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@doist/todoist-quickadd

Add Todoist QuickAdd anywhere on the web

latest
Source
npmnpm
Version
1.1.5
Version published
Maintainers
4
Created
Source

todoist-quickadd

Add the powerful Todoist Quick Add anywhere on the web. The experience is simple, beautiful, and fast.

The Todoist Quick Add also supports all of the powerful features, such as natural language parsing.

Installation

Use npm or yarn to install:

npm install @doist/todoist-quickadd
# or
yarn add @doist/todoist-quickadd

Usage (vanilla JavaScript)

import { showQuickAdd } from '@doist/todoist-quickadd'

showQuickAdd({
    content: 'Hello world',
    priority: 3,
    date: 'today',
})

Usage (React)

import { useState, useEffect } from 'react'

import { showQuickAdd } from '@doist/todoist-quickadd'

function Todoist() {
    const [content, setContent] = (useState < string) | (null > null)

    // Set up store listener
    useEffect(() => {
        const todoistListener = Store.addListener(() => {
            setContent(TodoistStore.getState().content)
        })
        return () => todoistListener && todoistListener.remove()
    }, [])

    // Handle content change
    useEffect(() => {
        function onLoadingError() {
            alert('Could not load Todoist Quick Add. Please try again later.')
        }

        if (content) {
            StoreActions.resetContent()

            showQuickAdd({
                content: content,
                onLoadingError: onLoadingError,
            })
        }
    }, [content])

    return null
}

showQuickAdd API

The showQuickAdd function can take the following parameters. All of them are optional:

NameTypeDescription
contentstringThe preset content
prioritynumber between 1 and 4The preset priority
themenumber between 1 and 11Force a specific Todoist theme (e.g, 2 for Todoist Red,
and 11 for Todoist Darkmode)
project_idnumberThe preset project (by default it's the Inbox)
onAdd(item: any) => voidCallback that will be called when a task is added.
onClose() => voidCallback that will be called when the Quick Add is closed
onLoadingError() => voidCallback that will be called when the Quick Add fails to load
todoistHoststringAn optional Todoist host, e.g. staging.todoist.com

Changelog

We're maintaining a changelog in this repository. Our versioning follows semantic versioning.

Releasing

A new version of todoist-quickadd is published both on npm and GitHub Package Registry whenever a new release on GitHub is created. A GitHub Action will automatically perform all the necessary steps.

The Action will release the version number that's specified inside the package.json's version field so make sure that it reflects the version you want to publish. Additionally, the Action can be triggered manually in case something went wrong in the automation.

Contributing

Contributions are welcome.

License

This project is distributed under the MIT License.

Keywords

todoist

FAQs

Package last updated on 03 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts