@dwlib/internal-slot
Version:
Internal Slot API
47 lines (41 loc) • 1.6 kB
Markdown
# Internal Slot API
## Abstract
The module for implementing internal slots of the objects using encapsulation.
## Install
`npm i --save /internal-slot`
## Usage
```javascript
// CJS
const InternalSlot = require('/internal-slot');
const DeleteInternalSlot = require('/internal-slot/DeleteInternalSlot');
const GetInternalSlot = require('/internal-slot/GetInternalSlot');
const HasInternalSlot = require('/internal-slot/HasInternalSlot');
const RequireInternalSlot = require('/internal-slot/RequireInternalSlot');
const SetInternalSlot = require('/internal-slot/SetInternalSlot');
// ESM
import InternalSlot, {
DeleteInternalSlot,
GetInternalSlot,
HasInternalSlot,
RequireInternalSlot,
SetInternalSlot
} from '/internal-slot';
import DeleteInternalSlot from '@dwlib/internal-slot/DeleteInternalSlot';
import GetInternalSlot from '@dwlib/internal-slot/GetInternalSlot';
import HasInternalSlot from '@dwlib/internal-slot/HasInternalSlot';
import RequireInternalSlot from '@dwlib/internal-slot/RequireInternalSlot';
import SetInternalSlot from '@dwlib/internal-slot/SetInternalSlot';
```
## API
- *static class* InternalSlot
- *static* delete(target, internalSlot)
- *static* get(target, internalSlot)
- *static* has(target, internalSlot)
- *static* require(target, internalSlot)
- *static* set(target, internalSlot)
### Builtins
- DeleteInternalSlot(target, internalSlot)
- GetInternalSlot(target, internalSlot)
- HasInternalSlot(target, internalSlot)
- RequireInternalSlot(target, internalSlot)
- SetInternalSlot(target, internalSlot)