package org.panda_lang.pandomium;

import org.cef.CefClient;
import org.panda_lang.pandomium.loader.PandomiumLoader;
import org.panda_lang.pandomium.loader.PandomiumProgressListener;
import org.panda_lang.pandomium.settings.PandomiumSettings;
import org.panda_lang.pandomium.wrapper.PandomiumCEF;
import org.panda_lang.pandomium.wrapper.PandomiumClient;

public class Pandomium {

    private final PandomiumSettings settings;
    private PandomiumCEF pcef;

    public Pandomium(PandomiumSettings settings) {
        this.settings = settings;
    }

    public void initialize() {
        Pandomium that = this;
        PandomiumLoader loader = new PandomiumLoader(this);

        loader.addProgressListener((state, progress) -> {
            if (state != PandomiumProgressListener.State.DONE) {
                return;
            }

            pcef = new PandomiumCEF(that);
            pcef.initialize();
        });

        loader.load();
    }

    public PandomiumClient createClient() {
        CefClient client = pcef.getCefApp().createClient();
        return new PandomiumClient(client);
    }

    public void exit() {
        if (pcef != null) {
            pcef.dispose();
            return;
        }

        System.exit(0);
    }

    public PandomiumCEF getRaw() {
        return pcef;
    }

    public PandomiumSettings getSettings() {
        return settings;
    }

}

@@ -416,24 +416,66 @@
 s settings;%0A
+    private final PandomiumLoader loader;%0A
     private 
@@ -587,49 +587,29 @@
     
-%7D%0A%0A
     
-public void initialize() %7B%0A       
+this.loader = new
  Pan
@@ -618,82 +618,59 @@
 mium
- that = 
+Loader(
 this
+)
 ;%0A    
+%7D%0A%0A
     
-PandomiumLoader loader = new PandomiumLoader(this);%0A
+public void initialize() %7B
 %0A   
@@ -866,18 +866,18 @@
 umCEF(th
-at
+is
 );%0A     
@@ -985,24 +985,135 @@
 eClient() %7B%0A
+        if (pcef == null) %7B%0A            throw new RuntimeException(%22Pandomium is not initialized%22);%0A        %7D%0A%0A
         CefC
@@ -1127,20 +1127,24 @@
 lient = 
-pcef
+getRaw()
 .getCefA
@@ -1413,32 +1413,103 @@
 rn pcef;%0A    %7D%0A%0A
+    public PandomiumLoader getLoader() %7B%0A        return loader;%0A    %7D%0A%0A
     public Pando

Allow access to the loader