Commonjs Example Modernjs Example TypeScript Example
const { createContinuousThreads } = require('./commonjs.cjs');
const { createThreads } = require('./commonjs.cjs');
const { createThread } = require('./commonjs.cjs');
//Create Thread
createThread(() => {
setTimeout(function() {
console.log(`new thread`);
} , 5000)
})
createThreads(5 , () => {
console.log('multiple threads');
})
createContinuousThreads(6 , () => {
console.log(`6 threads will run at a time :D after they end new thread will be created`);
})
import { createContinuousThreads } from './modernjs.mjs'
import { createThreads } from './modernjs.mjs'
import { createThread } from './modernjs.mjs'
//Create Thread
createThread(() => {
setTimeout(function() {
console.log(`new thread`);
} , 5000)
})
createThreads(5 , () => {
console.log('multiple threads');
})
createContinuousThreads(6 , () => {
console.log(`6 threads will run at a time :D after they end new thread will be created`);
})
import { createContinuousThreads } from '../typescript.ts';
import { createThreads } from '../typescript.ts';
import { createThread } from '../typescript.ts';
//Create Thread
createThread(() => {
setTimeout(function() {
console.log(`new thread`);
} , 5000)
});
createThreads(5 , () => {
console.log('multiple threads');
});
createContinuousThreads(6 , () => {
console.log(`6 threads will run at a time :D after they end new thread will be created`);
});