UNPKG

dop-stick

Version:

Source control tooling for versionable-upgradeable smart contracts

52 lines 1.73 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.IntroAdapter = void 0; const terminal_1 = require("../core/terminal"); class IntroAdapter { constructor() { this.frames = [ '> H_', '> He_', '> Hey_', '> Hey B_', '> Hey Be_', '> Hey Bel_', '> Hey Beli_', '> Hey Belie_', '> Hey Believ_', '> Hey Believe_', '> Hey Believe!_', '> Hey Believe! ✨', ]; this.clearLine = '\r\x1b[K'; this.frameDelay = 100; // milliseconds between frames } async playIntro(introText) { // Hide cursor during animation process.stdout.write('\x1b[?25l'); try { for (const frame of this.frames) { // Clear current line and write new frame process.stdout.write(this.clearLine); process.stdout.write(terminal_1.Terminal.colors.matrix(frame)); // Wait for next frame await this.sleep(this.frameDelay); } // Display the intro text in white process.stdout.write(this.clearLine); process.stdout.write(terminal_1.Terminal.introStyles.baseWhite(introText)); // Add final newline and small pause process.stdout.write('\n'); await this.sleep(500); } finally { // Always show cursor again process.stdout.write('\x1b[?25h'); } } sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } } exports.IntroAdapter = IntroAdapter; //# sourceMappingURL=introAdapter.js.map