stampit API
Search…
Introduction
Essentials
What is a Stamp
Installation
Specification
FAQ
API
Quick start
Basics
Methods
Properties
Deep properties
Initializers
Static properties
Static deep properties
Configuration
Deep configuration
Composers
Property descriptors
Static property descriptors
Name
Ecosystem
Ecosystem Overview
@stamp/collision
@stamp/required
@stamp/privatize
@stamp/named (DEPRECATED)
@stamp/instanceof
Powered By
GitBook
@stamp/named (DEPRECATED)
This stamp (aka behaviour) is built into the stampit since
[email protected]
and
@stamp/
[email protected]
.
@stamp/named (DEPRECATED)
Changes the
Stamp.name
property using the
new ES6 feature
.
Supported platforms: node>=4, iOS>=10, Edge, FF, Chrome, Safari
If used in a non-supported environment (node <v4, or IE any version) then nothing will throw. But the
Stamp.name
will always be
"Stamp"
.
Example
Default behaviour (without this stamp):
1
const
MyRegularStamp
=
compose
(
...
);
2
console
.
log
(
MyRegularStamp
.
name
);
// 'Stamp'
Copied!
New behaviour:
1
import
Named
from
'@stamp/named'
;
2
3
const
MyNamedStamp
=
MyRegularStamp
.
compose
(
Named
).
setName
(
'MyNamedStamp'
);
Copied!
Or if you don't want to import the stamp you can import only the method:
1
import
{
setName
}
from
'@stamp/named'
;
2
const
MyNamedStamp
=
MyRegularStamp
.
compose
(
setName
(
'MyNamedStamp'
));
Copied!
Then stamp receives a different name instead of the default "Stamp":
1
console
.
log
(
MyNamedStamp
.
name
);
// 'MyNamedStamp'
Copied!
Derived stamps behaviour:
1
// All derived stamps will also be named 'MyNamedStamp' until changed:
2
let
Stamp2
=
compose
(
...
,
MyNamedStamp
,
...
);
3
console
.
log
(
Stamp2
.
name
);
// WARNING! Still 'MyNamedStamp' !!!
4
5
// Overwriting the name
6
Stamp2
=
Stamp2
.
setName
(
'Stamp2'
);
7
console
.
log
(
Stamp2
.
name
);
// 'Stamp2' :)
Copied!
Ecosystem - Previous
@stamp/privatize
Next - Ecosystem
@stamp/instanceof
Last modified
3yr ago
Copy link
Contents
@stamp/named (DEPRECATED)
Example