- π: Node.js-like API: Write C++ code in a syntax and structure similar to Node.js, making it easier to learn and use.
- π: Embedded-compatible: Compatible with several devices like Arduino UNO | Esp8266 | Esp32 | Stm32
- π: High-performance: Leverage the speed and efficiency of C++ for demanding applications.
- π: Scalability: Build applications that can handle large workloads and grow with your needs.
- π: Open-source: Contribute to the project's development and customize it to your specific requirements.
improvements
- π: unix char decorator have been removed from
console.h and conio.h.
- π: events now are hard erased instead of soft erased to reduce memory usage.
- π: stream objects like
serial_t or file_t have been refined for better control and stability.
- π:
promise_t have been refined and now are supported by coroutines for better asynchronous performance.
Articles
Example
#include <nodepp/nodepp.h>
#include <nodepp/timer.h>
#include <nodepp/promise.h>
using namespace nodepp;
void onMain() { Serial.begin( 9600 );
promise_t<int, except_t> delayed_promise([=](res_t<int> res, rej_t<except_t> rej) {
console::log("Promise started, waiting for 1 second...");
timer::timeout([=]() { res(10); }, 1000);
});
delayed_promise.emit(); // Start the asynchronous task immediately
process::add( coroutine::add( COROUTINE(){
coBegin
console::log("Coroutine started. Pausing until promise settles...");
coWait( delayed_promise.is_pending() );
console::log("Promise settled! Checking result...");
if ( delayed_promise.is_resolved() ) {
console::done( "Resolved value:", delayed_promise.get_value().value() );
} elif ( delayed_promise.is_rejected() ) {
console::error("Rejected with error:", delayed_promise.get_value().error() );
} else {
console::error("Something Went Wrong");
}
coFinish
}));
}