0.1.0 • Published 3 years ago

ko-prefix-preprocess v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Prefix Pre-Processor

Knockout Prefix Pre-Processor provides a binding provider pre-processor for adding custom binding attribute syntax.

Usage

The default pre-processor will convert ko-x="y" to data-bind="x: y" runtime. The prefix can be anything HTML5 standards allow in attributes, example 'ko-' or 'ko:'. The default pre-processor will return value as is to binding handler.

const preprocess = require('ko-prefix-preprocess')
// also globally exported as 'koPrefixPreprocess'
ko.bindingProvider.instance.preprocessNode = preprocess('ko-', 'data-bind')

Multiple Pre-Processors

preprocess.configInstance(
	ko.bindingProvider.instance,
	...
	preprocess.default('ko-', 'data-bind'),
	...
)