mirror of
https://gitee.com/energye/energy.git
synced 2024-12-03 04:07:58 +08:00
41 lines
671 B
Go
41 lines
671 B
Go
|
//----------------------------------------
|
||
|
//
|
||
|
// Copyright © yanghy. All Rights Reserved.
|
||
|
//
|
||
|
// Licensed under Apache License 2.0
|
||
|
//
|
||
|
//----------------------------------------
|
||
|
|
||
|
package cef
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
)
|
||
|
|
||
|
type JSDouble struct {
|
||
|
ICEFv8Value
|
||
|
}
|
||
|
|
||
|
func (m *JSDouble) AsDouble() (*JSDouble, error) {
|
||
|
return m, nil
|
||
|
}
|
||
|
|
||
|
func (m *JSDouble) Value() float64 {
|
||
|
if val, err := m.DoubleValue(); err == nil {
|
||
|
return val
|
||
|
} else {
|
||
|
return 0.0
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (m *JSDouble) SetValue(value float64) {
|
||
|
m.valueType = V8_VALUE_DOUBLE
|
||
|
m.value = value
|
||
|
}
|
||
|
func (m *JSDouble) ToString() string {
|
||
|
if val, err := m.DoubleValue(); err == nil {
|
||
|
return fmt.Sprintf("%v", val)
|
||
|
}
|
||
|
return ""
|
||
|
}
|