Example #1
0
File: ko.go Project: theclapp/js
func (b *BaseViewModel) Get(keyPath string) *js.Object {
	obj := property.Get(b.Object, keyPath)
	if obj == js.Undefined {
		return obj
	}
	return obj.Invoke()
}
Example #2
0
File: ko.go Project: theclapp/js
func (b *BaseViewModel) Set(keyPath string, value interface{}) {
	obj := property.Get(b.Object, keyPath)
	if obj == js.Undefined {
		// if isArray(value) {
		//  v.Set(key, NewObservableArray(value))
		// } else {
		//  v.Set(key, NewObservable(value))
		// }
		panic("ViewModel has no key: " + keyPath)
	} else {
		obj.Invoke(value)
	}
}