コード例 #1
0
ファイル: reverse.go プロジェクト: gmlewis/go-frp
func Keypress(model Model, event dom.Event) Model {
	if t, ok := event.Target().(*dom.HTMLInputElement); ok {
		// TODO: save/restore focus and cursor position
		return Model(t.Value)
	}
	return model
}
コード例 #2
0
ファイル: app.go プロジェクト: influx6/examples
// CreateTodo is an event listener which creates a new todo and adds it to the
// todo list.
func (v *App) CreateTodo(ev dom.Event) {
	input, ok := ev.Target().(*dom.HTMLInputElement)
	if !ok {
		panic("Could not convert event target to dom.HTMLInputElement")
	}
	v.Todos.AddTodo(input.Value)
	document.QuerySelector(".new-todo").(dom.HTMLElement).Focus()
}
コード例 #3
0
ファイル: app.go プロジェクト: ryanemmm/todomvc
// ToggleAll toggles all the todos in the list.
func (v *App) ToggleAll(ev dom.Event) {
	input := ev.Target().(*dom.HTMLInputElement)
	if !input.Checked {
		v.Todos.UncheckAll()
	} else {
		v.Todos.CheckAll()
	}
}
コード例 #4
0
func paliIME(event dom.Event) {
	elm := event.Target().(*dom.HTMLInputElement)

	if lastInput != "" && elm.Value != "" {
		v := elm.Value
		if len(v) == (len(lastInput) + 1) {
			result := checkLastTwoCharacter(lastInput[len(lastInput)-1:], v[len(v)-1:])
			if result != "" {
				elm.Value = v[:len(v)-2] + result
			}
		}
	}
	lastInput = elm.Value
}
コード例 #5
0
ファイル: input.go プロジェクト: siongui/userpages
func inputKeyUp(event dom.Event) {
	input := event.Target().(*dom.HTMLInputElement)

	span := dom.GetWindow().Document().GetElementByID("foo2")
	span.SetInnerHTML(input.Value)
}