README
next-stub-singleton
Stub code for singleton.
installation
npm install -S @jswork/next-stub-singleton
usage
import '@jswork/next-stub-singleton';
class App {}
Object.assign(App, nx.stubSingleton());
export default App;
// stub code:
{
instance: null,
getSingleton: function(){},
getInstance: function() {
if (!this.instance) {
this.instance = new this();
}
return this.instance;
}
}
license
Code released under the MIT license.