Skip to content

Commit

Permalink
Simplify implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
jerivas committed Nov 21, 2023
1 parent 07a88d7 commit a4e624b
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions lib/src/js/compiler.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:js_util';

import 'package:node_interop/js.dart';

import 'compile.dart';
Expand All @@ -17,9 +15,7 @@ class Compiler {
}
}

class AsyncCompiler extends Compiler {
final List<Promise> _compilations = [];
}
class AsyncCompiler extends Compiler {}

/// The JS API Compiler class
///
Expand Down Expand Up @@ -64,20 +60,15 @@ final JSClass asyncCompilerClass = () {
'compileAsync': (AsyncCompiler self, String path,
[CompileOptions? options]) {
self.throwIfDisposed();
var compilation = compileAsync(path, options);
self._compilations.add(compilation);
return compilation;
return compileAsync(path, options);
},
'compileStringAsync': (AsyncCompiler self, String source,
[CompileStringOptions? options]) {
self.throwIfDisposed();
var compilation = compileStringAsync(source, options);
self._compilations.add(compilation);
return compilation;
return compileStringAsync(source, options);
},
'dispose': (AsyncCompiler self) async {
self._disposed = true;
await Future.wait(self._compilations.map(promiseToFuture<Object>));
},
});

Expand Down

0 comments on commit a4e624b

Please sign in to comment.