You can chain all the shortcut functions (see the full list above).
Below is just an example of what you can do. It is a utility stamp. If you compose it to any of your stamps then it will count the number of object instances created from your stamp. Feel free to remove unwanted parts.
InstanceCounter.js
constInstanceCounter=stampit().conf({ instanceCounter:0// number of instances of a particular stamp, incremental}).props({ instanceIndex:-1// an instance number, incremental}).methods({printInstanceIndex() {console.log('I am instance #',this.instanceIndex) } }).init(function (_, { stamp }) {this.instanceIndex =stamp.compose.configuration.instanceCounter // instance numberstamp.compose.configuration.instanceCounter +=1// increment the counter}).staticPropertyDescriptors({ // give the Stamp.name a non-default name. ES6 only. name: { value:'InstanceCounter' }}).statics({ printTotalInstanceCount() {console.log(this.compose.configuration.instanceCounter) } }).composers(function ({ stamp }) {// We need to reset the counter each time the InstanceCounter is composed with.stamp.compose.configuration.instanceCounter =0})
Same InstanceCounter stamp but using the classic stampit way.
InstanceCounter.js
constInstanceCounter=stampit({ conf: { instanceCounter:0// number of instances of a particular stamp, incremental }, props: { instanceIndex:-1// an instance number, incremental }, methods: {printInstanceIndex() {console.log('I am instance #',this.instanceIndex) } },init(_, { stamp }) {this.instanceIndex =stamp.compose.configuration.instanceCounter // instance numberstamp.compose.configuration.instanceCounter +=1// increment the counter }, staticPropertyDescriptors: { // give the Stamp.name a non-default name. ES6 only. name: { value:'InstanceCounter' } }, statics: { printTotalInstanceCount() {console.log(this.compose.configuration.instanceCounter) } },composers({ stamp }) {// We need to reset the counter each time the InstanceCounter is composed with.stamp.compose.configuration.instanceCounter =0 }});