Quick Start
Welcome to PromiseLogic! This guide will help you quickly master how to use logic gate semantics to compose Promises through a series of practical examples. Whether you're a beginner or an experienced developer, these examples will help you understand PromiseLogic's core concepts.
Prerequisites
Before You Start
- • Ensure PromiseLogic is properly installed following the Installation Guide
- • Familiar with basic JavaScript Promise concepts
- • Understand the fundamentals of asynchronous programming
- • Have your development environment ready (Node.js or browser)
Core Concepts Overview
AND Logic
Succeeds when all Promises succeed, equivalent to standard Promise.all()
OR Logic
Returns the first successful Promise, equivalent to Promise.any()
RACE Logic
Returns the first completed Promise, equivalent to Promise.race()
ALLSETTLED Logic
Waits for all Promises to complete, equivalent to Promise.allSettled()
Basic Examples
The following examples showcase PromiseLogic's four most commonly used logic gate operations. Each example can be directly copied and run in your project.
Basic AND Logic
Succeeds when all Promises succeed, equivalent to Promise.all()
Basic OR Logic
Returns the first successful Promise, equivalent to Promise.any()
Basic RACE Logic
Returns the first completed Promise (regardless of success or failure), equivalent to Promise.race()
Basic ALLSETTLED Logic
Waits for all Promises to complete (regardless of success or failure), equivalent to Promise.allSettled()
Composite Logic Application
Combine multiple logic gates to implement complex business logic
Next Steps
Deepen Your Learning
- • Check AND Logic Documentation for detailed usage
- • Explore OR Logic Documentation to learn service degradation strategies
- • Learn XOR Logic to implement mutually exclusive operations
- • Understand ALLSETTLED Logic for result analysis
Quick Start Tips
- • All examples can be run directly in browser console or Node.js environment
- • Recommended to understand basic examples before trying composite logic applications
- • Remember to add appropriate error handling in real projects
- • PromiseLogic is fully compatible with existing Promise code and can be migrated gradually
- • If you encounter issues, refer to detailed API documentation or submit an Issue