當前位置: 首頁>>代碼示例>>Golang>>正文


Golang console.Log函數代碼示例

本文整理匯總了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)
}
開發者ID:flimzy,項目名稱:flashback,代碼行數:9,代碼來源:sync.go

示例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
}
開發者ID:flimzy,項目名稱:flashback,代碼行數:10,代碼來源:login.go

示例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
}
開發者ID:flimzy,項目名稱:flashback,代碼行數:15,代碼來源:sync.go

示例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)
}
開發者ID:flimzy,項目名稱:flashback,代碼行數:7,代碼來源:main.go

示例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
}
開發者ID:FlashbackSRS,項目名稱:flashback,代碼行數:17,代碼來源:login.go

示例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)
}
開發者ID:snyderep,項目名稱:pongish,代碼行數:8,代碼來源:gateway.js.go

示例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}
}
開發者ID:flimzy,項目名稱:jqeventrouter,代碼行數:10,代碼來源:jqeventrouter.go

示例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)
	})
}
開發者ID:flimzy,項目名稱:flashback,代碼行數:18,代碼來源:auth.go

示例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")
}
開發者ID:flimzy,項目名稱:flashback,代碼行數:9,代碼來源:main.go

示例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)
}
開發者ID:snyderep,項目名稱:pongish,代碼行數:9,代碼來源:gateway.js.go

示例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)
}
開發者ID:flimzy,項目名稱:flashback,代碼行數:10,代碼來源:main.go

示例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()
}
開發者ID:flimzy,項目名稱:flashback,代碼行數:20,代碼來源:main.go

示例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))
	}
}
開發者ID:snyderep,項目名稱:pongish,代碼行數:21,代碼來源:gateway.js.go

示例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)
	}
}
開發者ID:govlas,項目名稱:logger,代碼行數:13,代碼來源:logger_js.go

示例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()
}
開發者ID:FlashbackSRS,項目名稱:flashback,代碼行數:15,代碼來源:state.go


注:本文中的honnef/co/go/js/console.Log函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。