-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: can be used in worker threads (#39)
- Loading branch information
Showing
44 changed files
with
1,619 additions
and
731 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# http://clang.llvm.org/docs/ClangFormatStyleOptions.html | ||
BasedOnStyle: Google | ||
DerivePointerAlignment: false | ||
MaxEmptyLinesToKeep: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict'; | ||
|
||
let canIUseWorkerThreads = false; | ||
let isMainThread = true; | ||
let threadId = 0; | ||
|
||
try { | ||
const workerThreads = require('worker_threads'); | ||
isMainThread = workerThreads.isMainThread; | ||
threadId = workerThreads.threadId; | ||
canIUseWorkerThreads = true; | ||
} catch (err) { | ||
err; | ||
} | ||
|
||
module.exports = { | ||
isMainThread, | ||
threadId, | ||
canIUseWorkerThreads, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use strict'; | ||
|
||
const cp = require('child_process'); | ||
const path = require('path'); | ||
const nodeVersion = process.versions.node; | ||
|
||
function exec(cmd) { | ||
cp.execSync(cmd, { | ||
cwd: path.join(__dirname, '../'), | ||
stdio: 'inherit', env: process.env | ||
}); | ||
} | ||
|
||
const tags = nodeVersion.split('.'); | ||
if (tags[0] < 8) { | ||
exec('npm run test-old'); | ||
} else { | ||
exec('npm run test-new'); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.