Skip to content

Commit

Permalink
[electron] Fix compile error when enabling electron plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyfa committed Dec 27, 2024
1 parent 7285f9e commit ad11ee3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions runtime/src/ceramic/PlatformSpecific.hx
Original file line number Diff line number Diff line change
Expand Up @@ -207,31 +207,31 @@ class PlatformSpecific {
#if (web && ceramic_use_electron)
static var testedElectronAvailability:Bool = false;
static var testedElectronRemoteAvailability:Bool = false;
static var electron:Null<Dynamic> = null;
static var electronRemote:Null<Dynamic> = null;
static var _electron:Null<Dynamic> = null;
static var _electronRemote:Null<Dynamic> = null;

inline public static function resolveElectron():Null<Dynamic> {

if (!testedElectronAvailability) {
testedElectronAvailability = true;
try {
final remote = electronRemote();
electron = js.Syntax.code("{0}.require('electron')", remote);
_electron = js.Syntax.code("{0}.require('electron')", remote);
}
catch (e:Dynamic) {}
}

return electron;
return _electron;

}

public static function nodeRequire(module:String):Null<Dynamic> {

resolveElectron();

if (electronRemote != null) {
if (_electronRemote != null) {

var required:Dynamic = js.Syntax.code("{0}.require({1})", electronRemote, module);
var required:Dynamic = js.Syntax.code("{0}.require({1})", _electronRemote, module);
return required;

}
Expand All @@ -246,12 +246,12 @@ class PlatformSpecific {
if (!testedElectronRemoteAvailability) {
testedElectronRemoteAvailability = true;
try {
electronRemote = js.Syntax.code("require('@electron/remote')");
_electronRemote = js.Syntax.code("require('@electron/remote')");
}
catch (e:Dynamic) {}
}

return electronRemote;
return _electronRemote;

}

Expand Down

0 comments on commit ad11ee3

Please sign in to comment.