Skip to content

0.5.0

Latest
Compare
Choose a tag to compare
@molszanski molszanski released this 08 Oct 01:08
· 5 commits to master since this release

What's Changed

Container Disposal

basic usage

import { createContainer } from "iti"

container = createContainer()
  .add({ a: () => "123" })
  .addDisposer({ a: () => {} })

container.get("a") === "123" // true
await container.disposeAll() // Promise<void>

async case

const container = createContainer()
  .add(() => ({
    dbConnection: async () => {
      /** connect to db and return an instance */
    },
  }))
  .addDisposer({
    //              ↓ `db` is a resolved value of a `dbConnection` token. Pretty handy
    dbConnection: (db) => db.close(),
  })

const db = await container.get("dbConnection")
await container.disposeAll()

Much Better Ts performance

Some huge projects consumed too much RAM and had some perf limits:
i18next/react-i18next#1417
TS2589: Type instantiation is excessively deep and possibly infinite
This was one of know issues:
https://itijs.org/docs/patterns-and-tips#known-issues

I believe that the issue is solved with this release

Full Changelog: 0.4.2...0.5.0