UNPKG
apim-developer-portal2
Version:
latest (2.0.4)
2.0.4
API management developer portal
apim-developer-portal2
/
src
/
bindingHandlers
/
acceptChange.ts
17 lines
(14 loc)
•
364 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import
*
as
ko
from
"knockout"
; ko.
extenders
.
acceptChange
=
(
target, condition
) =>
{
const
result = ko.
pureComputed
({
read
: target,
write
:
(
newValue
) =>
{
if
(!ko.
unwrap
(condition)) {
return
; }
target
(newValue); } });
result
(
target
());
return
result; };