aboutsummaryrefslogtreecommitdiff
path: root/src/utils/nonPooledThread.js
diff options
context:
space:
mode:
authorSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-09-17 23:47:59 +0800
committerGitHub <noreply@github.com>2022-09-17 23:47:59 +0800
commit364caae9b6e47b8d5e1bab950aebc5b35bc4baad (patch)
treee554b5859e0135b8f644986768306d5f3ee5683e /src/utils/nonPooledThread.js
parenteb8bc77bf2d790e97fe793eb96ad77e1b4d2bbbf (diff)
parent12f3a81cf12c6ffc24a7f2a0e8102dfba3fddf82 (diff)
downloadSoopyV2-364caae9b6e47b8d5e1bab950aebc5b35bc4baad.tar.gz
SoopyV2-364caae9b6e47b8d5e1bab950aebc5b35bc4baad.tar.bz2
SoopyV2-364caae9b6e47b8d5e1bab950aebc5b35bc4baad.zip
Merge pull request #71 from Soopyboo32/Babel
Diffstat (limited to 'src/utils/nonPooledThread.js')
-rw-r--r--src/utils/nonPooledThread.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/utils/nonPooledThread.js b/src/utils/nonPooledThread.js
new file mode 100644
index 0000000..4720700
--- /dev/null
+++ b/src/utils/nonPooledThread.js
@@ -0,0 +1,14 @@
+let Executors = Java.type("java.util.concurrent.Executors")
+
+class NonPooledThread {
+ constructor(fun) {
+ this.fun = fun
+ this.executor = Executors.newSingleThreadExecutor()
+ }
+
+ start() {
+ this.executor.execute(this.fun)
+ }
+}
+
+export default NonPooledThread \ No newline at end of file