本文整理汇总了Golang中honnef/co/go/js/console.Log函数的典型用法代码示例。如果您正苦于以下问题:Golang Log函数的具体用法?Golang Log怎么用?Golang Log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: DoSync
func DoSync() {
host := util.CouchHost()
dbName := "user-" + util.CurrentUser()
ldb := pouchdb.New(dbName)
rdb := pouchdb.New(host + "/" + dbName)
result, err := pouchdb.Replicate(rdb, ldb, pouchdb.Options{})
console.Log("error = %j", err)
console.Log("result = %j", result)
}
示例2: CordovaLogin
func CordovaLogin() bool {
console.Log("CordovaLogin()")
js.Global.Get("facebookConnectPlugin").Call("login", []string{}, func() {
console.Log("Success logging in")
}, func() {
console.Log("Failure logging in")
})
console.Log("Leaving CordovaLogin()")
return false
}
示例3: BeforeTransition
func BeforeTransition(event *jquery.Event, ui *js.Object) bool {
console.Log("sync BEFORE")
go func() {
container := jQuery(":mobile-pagecontainer")
jQuery("#syncnow", container).On("click", func() {
console.Log("Attempting to sync something...")
go DoSync()
})
jQuery(".show-until-load", container).Hide()
jQuery(".hide-until-load", container).Show()
}()
return true
}
示例4: ConsoleEvent
func ConsoleEvent(name string, event *jquery.Event, data *js.Object) {
page := data.Get("toPage").String()
if page == "[object Object]" {
page = data.Get("toPage").Call("jqmData", "url").String()
}
console.Log("Event: %s, Current page: %s", name, page)
}
示例5: CordovaLogin
func CordovaLogin() bool {
console.Log("CordovaLogin()")
js.Global.Get("facebookConnectPlugin").Call("login", []string{}, func() {
console.Log("Success logging in")
u, err := repo.CurrentUser()
if err != nil {
fmt.Printf("No user logged in?? %s\n", err)
} else {
// To make sure the DB is initialized as soon as possible
u.DB()
}
}, func() {
console.Log("Failure logging in")
})
console.Log("Leaving CordovaLogin()")
return false
}
示例6: handleBallInPlayMessage
func (g *gateway) handleBallInPlayMessage(v *vector) {
console.Log(fmt.Sprintf("handling ball in play message - y pos: %d, angle: %v, speed: %v\n", v.yPos, v.angle, v.speed))
// Note angle is always specified as if for the LEFT side player, the RIGHT side player
// will do the inverse.
g.canvas.ballStart(v)
}
示例7: Listen
// Listen attaches the Handler to the window and begins listening for the specified
// jQuery event, reterning an EventListener object
func Listen(event string, handler Handler) *EventListener {
console.Log("Adding jQuery event listener")
listener := func(event *jquery.Event, data *js.Object) bool {
return handler.HandleEvent(event, data, url.Values{})
}
jquery.NewJQuery(js.Global.Get("document")).On(event, listener)
return &EventListener{event: event, listener: listener}
}
示例8: CheckAuth
func CheckAuth(h jqeventrouter.Handler) jqeventrouter.Handler {
return jqeventrouter.HandlerFunc(func(event *jquery.Event, ui *js.Object) bool {
console.Log("CheckAuth")
uri := util.JqmTargetUri(ui)
console.Log("Auth URI = %s", uri)
if uri != "/login.html" && util.CurrentUser() == "" {
console.Log("nobody's logged in")
// Nobody's logged in
ui.Set("toPage", "login.html")
event.StopImmediatePropagation()
console.Log("Attempting to re-trigger the event")
jquery.NewJQuery(":mobile-pagecontainer").Trigger("pagecontainerbeforechange", ui)
return true
}
console.Log("Auth allowing to proceed")
return h.HandleEvent(event, ui)
})
}
示例9: initjQueryMobile
func initjQueryMobile() {
jQuery(document).On("mobileinit", func() {
console.Log("mobileinit")
MobileInit()
})
// This is what actually loads jQuery Mobile. We have to register our 'mobileinit'
// event handler above first, though.
js.Global.Call("postInit")
}
示例10: handlePlayMessage
func (g *gateway) handlePlayMessage(side string) {
dSide := strings.ToUpper(side)
console.Log(fmt.Sprintf("handling play message - side: %s\n", dSide))
g.statusEl.SetTextContent("Playing (" + dSide + ")")
g.canvas.reset(dSide)
}
示例11: initCordova
func initCordova(wg *sync.WaitGroup) {
if !cordova.IsMobile() {
return
}
wg.Add(1)
document.Call("addEventListener", "deviceready", func() {
defer wg.Done()
console.Log("Cordova device ready")
}, false)
}
示例12: main
func main() {
console.Log("in main()")
var wg sync.WaitGroup
initjQuery(&wg)
initCordova(&wg)
// state := clientstate.New()
// api := flashback.New(jQuery("link[rel=flashback]").Get(0).Get("href").String())
// ctx := context.Background()
// ctx = context.WithValue(ctx, "cordova", cordova)
// ctx = context.WithValue(ctx, "AppState", state)
// ctx = context.WithValue(ctx, "api", api)
// ctx = context.WithValue(ctx, "couchhost", jQuery("link[rel=flashbackdb]").Get(0).Get("href").String())
// Wait for the above modules to initialize before we initialize jQuery Mobile
wg.Wait()
console.Log("Done with main()")
initjQueryMobile()
}
示例13: handleMessage
func (g *gateway) handleMessage(msg []byte) {
m := string(msg)
parts := strings.Split(m, ",")
if parts[0] == "P" {
g.handlePlayMessage(parts[1])
} else if parts[0] == "B" {
// 1 = y position
// 2 = angle
// 3 = speed
v, err := newVectorFromStrings(parts[1], parts[2], parts[3])
if err != nil {
console.Log(err.Error())
}
g.handleBallInPlayMessage(v)
} else {
console.Log(fmt.Sprintf("unsupported message: %s\n", m))
}
}
示例14: printLog
func printLog(prefix string, printTrace bool, message string, v ...interface{}) {
mess := fmt.Sprintf("%s %s %s", time.Now().Format(timeFormat), prefix, fmt.Sprintf(message, v...))
switch prefix {
case WarnPrefix:
console.Warn(mess)
case ErrPrefix:
console.Error(mess)
default:
console.Log(mess)
}
}
示例15: Read
func Read() {
db := pouchdb.New("flashback")
var newState = State{}
if err := db.Get("_local/state", &newState, pouchdb.Options{}); err != nil {
if pouchdb.IsNotExist(err) {
// File not found, no problem
} else {
state.lastError = err
console.Log(err)
return
}
}
state = &newState
state.lastRead = time.Now()
}