1.1.19 • Published 5 years ago

@singleware/class v1.1.19

Weekly downloads
23
License
MIT
Repository
github
Last release
5 years ago

Class

This package provides some decorators to ensure the class member visibility at runtime.

How it works

When the JS run all decorators defined for your class will wrap the original methods to check its access rules, before pass the control back to the original method if the called method is private or protected, the wrapper goes check the context to determine if the current call is granted or not.

Usage

import * as Class from '@singleware/class';

@Class.Describe()
class Example extends Class.Null {
  @Class.Private()
  private privateProperty = '';

  @Class.Protected()
  @Class.Property()
  protected protectedProperty = '';

  @Class.Public()
  @Class.Property()
  public publicProperty = '';

  @Class.Private()
  private privateMethod(): void {}

  @Class.Protected()
  protected protectedMethod(): void {}

  @Class.Public()
  public publicMethod(): void {}
}

Decorators

NameDescription
DescribeWraps the decorated class to ensure its rules at runtime.
PrivateMakes the decorated member as private, visible only by its class.
ProtectedMakes the decorated member as protected, visible on by its class and derived classes
PublicMakes the decorated member as public, visible by every class.
PropertyMakes the decorates member as enumerable to use with loop statements like for...

Methods

NameDescription
performPerforms the specified callback using the specified context rules.
resolveResolves the given wrapped context to the original context.

Install

Using npm:

npm i @singleware/class

License

MIT © Silas B. Domingos

1.1.19

5 years ago

1.1.18

5 years ago

1.1.17

5 years ago

1.1.16

5 years ago

1.1.15

5 years ago

1.1.14

5 years ago

1.1.13

5 years ago

1.1.12

6 years ago

1.1.11

6 years ago

1.1.9

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago