Skip to content

Commit

Permalink
fix: made code samples runnable (#3535) (#3596)
Browse files Browse the repository at this point in the history
  • Loading branch information
berezinant committed May 7, 2024
1 parent bf056d6 commit 2d45e27
Showing 1 changed file with 5 additions and 0 deletions.
Expand Up @@ -104,6 +104,11 @@ const initPlayground = (theme) => {
// As an alternative we could extract this samples-specific script to new js file but then we would handle dark mode in 2 separate files which is not ideal
const samplesAreEnabled = () => {
try {
if (typeof KotlinPlayground === 'undefined') {
// KotlinPlayground is exported universally as a global variable or as a module
// Due to possible interaction with other js scripts KotlinPlayground may not be accessible directly from `window`, so we need an additional check
KotlinPlayground = exports.KotlinPlayground;
}
KotlinPlayground
return true
} catch (e) {
Expand Down

0 comments on commit 2d45e27

Please sign in to comment.