Skip to content

Latest commit

 

History

56 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

meanwhile.nvim

Promises and async utilities for Neovim.

meanwhile.nvim started as a project for learning and experimenting with async programming in Lua and Neovim. While other Promise libraries already exist, the project grew into a fairly feature-rich implementation, so I decided to publish it for others who might find it useful.

Features

  • Generic JavaScript-like Promise implementation
  • EmmyLua annotations for type checking
  • Promise chaining with :next(), :catch(), and :finally()
  • Promise.all() for combining multiple async operations
  • Coroutine-based async() / await()
  • promisify() for adapting callback-based APIs

Requirements

Example

local meanwhile = require('meanwhile')

local Promise = meanwhile.Promise
local async = meanwhile.async
local await = meanwhile.await

local get_value = async(function()
  return await(Promise.resolve(21))
end)

get_value():next(function(value)
  print(value * 2) -- 42
end)

Installation

Install meanwhile.nvim using your preferred Neovim plugin manager.

For example, with vim.pack:

vim.pack.add({
  'https://github.com/saffr3n/meanwhile.nvim',
})

Then:

local meanwhile = require('meanwhile')

Documentation

See :help meanwhile for the complete API documentation.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages