Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#208 Add worker termination conditions and method #274

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/js/elk-api.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2017 Kiel University and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
export default class ELK {
Expand Down Expand Up @@ -89,6 +89,7 @@ export default class ELK {
}

terminateWorker() {
if(this.worker)
this.worker.terminate()
}

Expand Down Expand Up @@ -144,11 +145,11 @@ class PromisedWorker {
}

terminate() {
if (this.worker.terminate) {
if (this.worker) {
this.worker.terminate()
}
}

convertGwtStyleError(err) {
if (!err) {
return
Expand All @@ -167,5 +168,5 @@ class PromisedWorker {
}
delete err['__java$exception']
}
}
}
}
11 changes: 6 additions & 5 deletions typings/elk-api.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2019 TypeFox and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/

Expand Down Expand Up @@ -116,6 +116,7 @@ export interface ELK {
knownLayoutAlgorithms(): Promise<ElkLayoutAlgorithmDescription[]>
knownLayoutOptions(): Promise<ElkLayoutOptionDescription[]>
knownLayoutCategories(): Promise<ElkLayoutCategoryDescription[]>
terminateWorker(): void;
}

export interface ELKConstructorArguments {
Expand Down
Loading