1.0.34 • Published 3 years ago
@abstraqt-dev/jsxknockout v1.0.34
This package contains an extension of the jsx-dom library that allows to generate knockout virtual elements through the use of custom tags.
Usage:
import * as ko from "knockout";
import * as React from "@abstraqt-dev/jsxknockout";
ko.component.register("my-component", {
viewModel: {
createViewModel: function(params, componentInfo) {
var vm = {
panelShown: ko.observable(false),
buttonClick: function() {
vm.panelShown(!vm.panelShown());
}
};
return vm;
}
},
template: [
<div>
<ko-if data-bind="panelShown">
<h1>Hello World</h1>
</ko-if>
<div>
<button type="button" data-bind="click: buttonClick">Switch</button>
</div>
</div>
]
});
document.appendChild("<my-component></my-component>");
ko.applyBinding({});
NOTE: Every html element whose name starts with "ko-" is considered a knockout virtual element placeholder and is transformed as follows:
<ko-if data-bind="BooleanValue">
<h1>Test</h1>
</ko-if>
// Is transformed to
<!-- ko if: BooleanValue -->
<h1>Test</h1>
<!-- /ko -->
<ul>
<ko-foreach data-bind="Items">
<li data-bind="text: $data">
</li>
</ko-foreach>
<li>
</li>
</ul>
// Is transformed to
<ul>
<!-- ko foreach: Items -->
<li data-bind="text: $data">
</li>
<!-- /ko -->
<li>
</li>
</ul>
1.0.33
3 years ago
1.0.34
3 years ago
1.0.32
3 years ago
1.0.31
3 years ago
1.0.30
3 years ago
1.0.29
3 years ago
1.0.28
3 years ago
1.0.27
3 years ago
1.0.26
3 years ago
1.0.25
3 years ago
1.0.24
3 years ago
1.0.23
3 years ago
1.0.22
3 years ago
1.0.21
3 years ago
1.0.20
3 years ago
1.0.19
3 years ago
1.0.18
3 years ago
1.0.17
3 years ago
1.0.16
4 years ago
1.0.15
4 years ago
1.0.14
4 years ago
1.0.13
4 years ago
1.0.12
4 years ago
1.0.9
4 years ago
1.0.8
4 years ago
1.0.7
4 years ago
1.0.11
4 years ago
1.0.10
4 years ago
1.0.6
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago
1.0.3
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago