Rocky_Mountain_Vending/.pnpm-store/v10/files/b3/12f44e8e7c50798b5f222811133e84940074f6b799d90fd08f40c4829ac50f5547acda6b10400106b80ed7b202098fca5b5006f2436d303bfc4f65194a9997
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

50 lines
1.5 KiB
Text

/* IMPORT */
import process from 'node:process';
import { IS_WINDOWS } from './constants.js';
import Signals from './signals.js';
/* MAIN */
class Interceptor {
/* CONSTRUCTOR */
constructor() {
/* VARIABLES */
this.callbacks = new Set();
this.exited = false;
/* API */
this.exit = (signal) => {
if (this.exited)
return;
this.exited = true;
for (const callback of this.callbacks) {
callback();
}
if (signal) {
if (IS_WINDOWS && (signal !== 'SIGINT' && signal !== 'SIGTERM' && signal !== 'SIGKILL')) { // Windows doesn't support POSIX signals, but Node emulates these 3 signals for us
process.kill(process.pid, 'SIGTERM');
}
else {
process.kill(process.pid, signal);
}
}
};
this.hook = () => {
process.once('exit', () => this.exit());
for (const signal of Signals) {
try {
process.once(signal, () => this.exit(signal));
}
catch {
// Sometimes "process.once" can throw...
}
}
};
this.register = (callback) => {
this.callbacks.add(callback);
return () => {
this.callbacks.delete(callback);
};
};
this.hook();
}
}
/* EXPORT */
export default new Interceptor();