Skip to content

Commit

Permalink
feat(ootk-multi): added multithreading class
Browse files Browse the repository at this point in the history
  • Loading branch information
thkruz committed Jan 15, 2021
1 parent 6887e7f commit 774ec62
Show file tree
Hide file tree
Showing 11 changed files with 422 additions and 15 deletions.
90 changes: 88 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
"typescript": "^4.1.3",
"typescript-eslint": "^0.0.1-alpha.0",
"webpack": "^5.11.1",
"webpack-cli": "^4.3.1"
"webpack-cli": "^4.3.1",
"worker-loader": "^3.0.7"
},
"homepage": "https://github.com/thkruz/ootk",
"directories": {
Expand Down
12 changes: 12 additions & 0 deletions sandbox.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<html>
<head>
<script src="./dist/ootk.js"></script>
<script>
var line1 = "1 00005U 58002B 00179.78495062 .00000023 00000-0 00098-0 0 4753";
var line2 ="2 00005 34.2682 348.7242 1859667 331.7664 19.3264 10.82419157413667";
var satrec = Ootk.Sgp4.createSatrec(line1, line2, "wgs72", "i");
var multi = new Ootk.Multi(8);
multi.propagate([satrec], [0,1,2,3,4,5,6,7,8,9,10]).then((m) => console.log(m))
</script>
</head>
</html>
41 changes: 38 additions & 3 deletions scripts/umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ let config = {
loader: 'babel-loader',
},
},
{
test: /\.worker\.js$/u,
use: { loader: 'worker-loader' },
},
{
test: /\.html$/iu,
loader: 'html-loader',
Expand All @@ -27,13 +31,14 @@ let config = {

let umd = {
...config,
name: 'ootk-sgp4',
name: 'ootk',
mode: 'production',
entry: {
'ootk': ['./lib/ootk.js'],
'ootk-sgp4': ['./lib/ootk-sgp4.js'],
'ootk-transforms': ['./lib/ootk-transforms.js'],
'ootk-utils': ['./lib/ootk-utils.js'],
'ootk-multi': ['./lib/ootk-multi.js'],
},
output: {
filename: '[name].js',
Expand All @@ -51,13 +56,14 @@ let umd = {

let minUmd = {
...config,
name: 'ootk-sgp4',
name: 'ootk',
mode: 'production',
entry: {
'ootk': ['./lib/ootk.js'],
'ootk-sgp4': ['./lib/ootk-sgp4.js'],
'ootk-transforms': ['./lib/ootk-transforms.js'],
'ootk-utils': ['./lib/ootk-utils.js'],
'ootk-multi': ['./lib/ootk-multi.js'],
},
output: {
filename: '[name].min.js',
Expand All @@ -83,6 +89,35 @@ let minUmd = {
stats: 'errors-warnings',
};

let workers = {
...config,
name: 'ootk',
mode: 'production',
entry: {
'ootk-multi': ['./src/ootk-multi.worker.js'],
},
output: {
filename: 'ootk-multi.js',
// eslint-disable-next-line no-path-concat, no-undef
path: __dirname + '/../dist',
globalObject: 'this',
},
optimization: {
minimize: false,
minimizer: [
new TerserPlugin({
terserOptions: {
format: {
comments: /@copyright/iu,
},
},
extractComments: false,
}),
],
},
stats: 'errors-warnings',
};

// Return Array of Configurations
// eslint-disable-next-line no-undef
module.exports = [umd, minUmd];
module.exports = [umd, minUmd, workers];
Loading

0 comments on commit 774ec62

Please sign in to comment.