fix(search): show torrent page from remote peer

This commit is contained in:
Alexey Kasyanchuk
2018-03-05 04:01:08 +03:00
parent 857bc66c7f
commit 1c626fa2bf
7 changed files with 84 additions and 29 deletions

29
src/app/singleton.js Normal file
View File

@ -0,0 +1,29 @@
export default (Superclass) => {
let instance;
return class Singleton extends Superclass {
constructor(props) {
super(props)
if (instance) {
instance.props = props
return instance;
}
instance = this;
}
static instance() {
if (instance) {
return instance;
} else {
return new Singleton();
}
}
static do(key, ...params) {
if ( typeof this.instance()[key] === 'function') {
return this.instance()[key](...params);
} else {
return this.instance()[key];
}
}
}
}