Attributes
Includes Deno configuration
Repository
Current version released
a year ago
Versions
Stage3
Polyfill for TC39 Stage 3 proposals
https://github.com/tc39/proposals#stage-3
Installation
Node.js
# npm
npm install --save @myty/stage3
# yarn
yarn add @myty/stage3
# pnpm
pnpm install --save @myty/stage3
Deno
import "https://deno.land/x/stage3/mod.ts";
import "https://deno.land/x/stage3/promise-with-resolvers.ts";
Usage
import "@myty/stage3/script/promise-with-resolvers"; // Node.js (commonjs)
import "@myty/stage3/esm/promise-with-resolvers"; // Node.js (module)
import "https://deno.land/x/stage3/promise-with-resolvers.ts"; // Deno
// Arrange
const resolvedValue = 5;
const { resolve, promise } = Promise.withResolvers<number>();
// Act
setTimeout(() => resolve(resolvedValue), 10);
const result = await promise;
// Assert
assertEquals(result, resolvedValue);