Skip to main content
Version: 1.2

Class

Concept

Allows to define a subclass for this protocol to use other protocols, as to conform to other object models.

Folder structure

├── class
│ ├── index.js
│ ├── protocols.js
  • The class folder contains
    • the es6 models handled by the protocol.
    • the protocols declaration.

Variant entry points

None

Usage

Declare a class

export default ({ ParentClass }) => class TargetClass extends ParentClass {
disposableOrphans() {
const items = super.disposableOrphans ? super.disposableOrphans() : []
return [
...items,
'wallet'
]
}

disposableChildren() {
const items = super.disposableChildren ? super.disposableChildren() : []
return [
...items,
'wallet'
]
}
}

Use protocols

export default [
//protocolslist
]

See declaring protocols

Example

We want our protocol walletable to use disposableOrphans and disposableChildren to manage data consistency over deletion:

class/index.js

export default ({ ParentClass }) => class TargetClass extends ParentClass {   

disposableOrphans() {
const items = super.disposableOrphans ? super.disposableOrphans() : []
return [
...items,
'wallet'
]
}

disposableChildren() {
const items = super.disposableChildren ? super.disposableChildren() : []
return [
...items,
'wallet'
]
}
}

class/protocols.js

export default [
"disposableorphansable",
"disposablechildrenable"
]