Installation Guide

Getting StartedQuickly install PromiseLogic and get started

PromiseLogic is a lightweight JavaScript library that provides Promise composition operations based on logic gate semantics. With intuitive logic gate naming, asynchronous programming becomes clearer and easier to understand.

Environment Requirements

Supported Environments

  • Node.js: Version 12.0.0 and above
  • Browser: Modern browsers with ES6 support (Chrome 60+, Firefox 55+, Safari 12+, Edge 79+)

Installation Methods

Install with npm

Npm
npm install promise-logic

Install with yarn

Yarn
yarn add promise-logic

Install with pnpm

Pnpm
pnpm add promise-logic

Install via CDN (Browser Environment)

Html
<script src="https://unpkg.com/promise-logic@latest/dist/promise-logic.umd.js"></script>

After importing via CDN, the global variable is PromiseLogic

Import and Usage

ES6 Module Import

Javascript
import { PromiseLogic } from 'promise-logic';

CommonJS Import

Javascript
const { PromiseLogic } = require('promise-logic');

Global Variable Usage (CDN Method)

Javascript
// Use directly after importing via script tag
const result = await PromiseLogic.and([promise1, promise2]);

Verify Installation

Javascript
// Verify that PromiseLogic is correctly installed
import { PromiseLogic } from 'promise-logic';

async function verifyInstallation() {
  try {
    const result = await PromiseLogic.and([
      Promise.resolve('Verification successful'),
      Promise.resolve('PromiseLogic is working correctly')
    ]);
    
    console.log('✅ PromiseLogic installed successfully!');
    console.log('Verification result:', result);
    return result;
  } catch (error) {
    console.error('❌ PromiseLogic installation failed:', error);
    throw error;
  }
}

// Execute verification
verifyInstallation();

Installation Notes

  • Ensure your Node.js version meets requirements, check with node --version
  • If you encounter installation issues, try clearing npm cache: npm cache clean --force
  • For browser environments, ensure your build tool correctly configures external dependencies