knockout.lifecycle

Enhance knockout component with lifecycle methods.

Usage no npm install needed!

<script type="module">
  import knockoutLifecycle from 'https://cdn.skypack.dev/knockout.lifecycle';
</script>

README

knockout.lifecycle

Usage

Install from NPM:

npm install knockout.lifecycle --save
<script src="knockout.3.4.0.js"></script>
<script src="./node_modules/knockout.fitler/dest/knockout.lifecycle.js"></script>

Example

export default {
    methods: {
        ready() {
            // dom rendered
            console.log(this.componentInfo.element);

            // ref sub components
            this.subComponent = this.ref('sub-component');
        }
    }
};

License

MIT © BinRui.Guan