I have imported a library from main_darwin.go example, when i instantiate and create an object from the library the browser window would create but stay frozen without loading the local html page. here is what it looks like :
http://i.imgur.com/kV8YNkq.png
Here is my main_darwin.go :
package main
import (
"cef"
"cocoa"
"os"
"log"
"os/exec"
"fmt"
"
github.com/eris-ltd/decerver"
"
github.com/eris-ltd/decerver-modules/ipfs"
"
github.com/eris-ltd/decerver-modules/legalmarkdown"
"
github.com/eris-ltd/decerver-modules/monk"
)
var Logger *log.Logger = log.New(os.Stdout, "[main] ", log.Lshortfile)
func main() {
// Executable's directory
exeDir := cocoa.GetExecutableDir()
// CEF subprocesses.
cef.ExecuteProcess(nil)
// Initialize CEF.
settings := cef.Settings{}
settings.CachePath = exeDir + "/webcache" // Set to empty to disable
settings.LogSeverity = cef.LOGSEVERITY_DEFAULT // LOGSEVERITY_VERBOSE
settings.LogFile = exeDir + "/debug.log"
//settings.LocalesDirPath = cwd + "/cef.framework/Resources"
//settings.ResourcesDirPath = cwd + "/cef.framework/Resources"
cef.Initialize(settings)
// Create Window using Cocoa API.
cocoa.InitializeApp()
window := cocoa.CreateWindow("Snapthereum", 1024, 768)
cocoa.ConnectDestroySignal(window, OnDestroyWindow)
cocoa.ActivateApp()
startMonk()
// Create browser.
browserSettings := cef.BrowserSettings{}
url := "file://" + exeDir + "/example.html"
cef.CreateBrowser(window, browserSettings, url)
focusDapp()
// CEF loop and shutdown.
cef.RunMessageLoop()
cef.Shutdown()
os.Exit(0)
}
func startMonk(){
dc := decerver.NewDeCerver()
fm := ipfs.NewIpfsModule()
lmd := legalmarkdown.NewLmdModule()
mjs := monkjs.NewMonkModule()
//bci := blockchaininfo.NewBlkChainInfo()
dc.LoadModule(fm)
dc.LoadModule(lmd)
//dc.LoadModule(bci)
dc.LoadModule(mjs)
errInit := dc.Init()
if errInit != nil {
fmt.Printf("Module failed to initialize: %s. Shutting down.\n", errInit.Error())
os.Exit(1)
}
//Run decerver
errStart := dc.Start()
if errStart != nil {
fmt.Printf("Module failed to start: %s. Shutting down.\n", errStart.Error())
os.Exit(1)
}
}
func focusDapp(){
focus := exec.Command("curl","
http://localhost:3000/admin/switch/monkadmin")
focus.Stdout = os.Stdout
focus.Stderr = os.Stderr
focus.Run()
}
func OnDestroyWindow() {
cef.QuitMessageLoop()
}