Skip to content

Commit d22b01b

Browse files
committed
Lazy init for default frontend context.
1 parent 713a5fd commit d22b01b

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/LetsPlot.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@ import org.jetbrains.letsPlot.intern.settings.GlobalSettings
1515
import org.jetbrains.letsPlot.intern.settings.createDefaultFrontendContext
1616

1717
object LetsPlot {
18-
var frontendContext: FrontendContext = createDefaultFrontendContext()
18+
private var customFrontendContext: FrontendContext? = null
19+
private val defaultFrontendContext by lazy { createDefaultFrontendContext() }
20+
21+
var frontendContext: FrontendContext
22+
get() = customFrontendContext ?: defaultFrontendContext
23+
set(value) {
24+
customFrontendContext = value
25+
}
1926

2027
var theme: Feature? = null // either null or OptionsMap
2128
set(value) {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
lets_plot.version=4.7.1
1+
lets_plot.version=4.7.2
22
lets_plot_kotlin_api.version=4.11.1-SNAPSHOT

0 commit comments

Comments
 (0)