1.0.34 • Published 4 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
4 years ago
1.0.34
4 years ago
1.0.32
4 years ago
1.0.31
4 years ago
1.0.30
4 years ago
1.0.29
4 years ago
1.0.28
5 years ago
1.0.27
5 years ago
1.0.26
5 years ago
1.0.25
5 years ago
1.0.24
5 years ago
1.0.23
5 years ago
1.0.22
5 years ago
1.0.21
5 years ago
1.0.20
5 years ago
1.0.19
5 years ago
1.0.18
5 years ago
1.0.17
5 years ago
1.0.16
5 years ago
1.0.15
5 years ago
1.0.14
5 years ago
1.0.13
5 years ago
1.0.12
5 years ago
1.0.9
5 years ago
1.0.8
5 years ago
1.0.7
5 years ago
1.0.11
5 years ago
1.0.10
5 years ago
1.0.6
5 years ago
1.0.5
5 years ago
1.0.4
5 years ago
1.0.3
5 years ago
1.0.2
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago