Socket
Socket
Sign inDemoInstall

knockout-decorators

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

knockout-decorators - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

2

package.json
{
"name": "knockout-decorators",
"version": "0.1.1",
"version": "0.1.2",
"description": "Decorators for use Knockout JS in TypeScript and ESNext environments",

@@ -5,0 +5,0 @@ "main": "dist/knockout-decorators.js",

@@ -6,5 +6,6 @@ # Knockout Decorators

[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/gnaeus/knockout-decorators/master/LICENSE)
[![npm version](https://img.shields.io/npm/v/knockout-decorators.svg?style=flat)](https://www.npmjs.com/package/knockout-decorators)
### Example
```ts
```js
import { observable, computed, component } from "knockout-decorators";

@@ -41,3 +42,3 @@

Property decorator that creates hidden `ko.observable` with ES6 getter and setter for it
```ts
```js
class Model {

@@ -54,3 +55,3 @@ @observable field = 123;

Accessor decorator that wraps ES6 getter and setter (if defined) to hidden (maybe writeable) `ko.pureComputed`
```ts
```js
class Person {

@@ -72,3 +73,3 @@ @observable firstName = "";

#### <a name="knockout-decorators-component"></a> @component
```ts
```js
@component(name: string, options?: Object);

@@ -79,2 +80,3 @@ @component(name: string, template: any, options?: Object);

Shorthand for registering Knockout component by decorating ViewModel class
| argument | description |

@@ -94,3 +96,3 @@ |----------|--------------------------------------------------------------------|

then it will be registered as `viewModel:` in config object.
```ts
```js
@component("my-component")

@@ -109,5 +111,5 @@ class Component {

If ViewModel constructor accepts two or three arguments,
then it `createViewModel` factory is created and component config
then `createViewModel:` factory is created and
`{ element, templateNodes }` are passed as arguments to ViewModel constructor.
```ts
```js
@component("my-component",

@@ -114,0 +116,0 @@ require("./my-component.html"),

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc