From 168b5bb723e9dd136ef33e958640778720a7827d Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 18 Feb 2017 16:42:41 +0900 Subject: :v: --- src/web/app/common/scripts/i.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/web/app/common/scripts/i.js (limited to 'src/web/app/common/scripts/i.js') diff --git a/src/web/app/common/scripts/i.js b/src/web/app/common/scripts/i.js new file mode 100644 index 0000000000..66ce37d506 --- /dev/null +++ b/src/web/app/common/scripts/i.js @@ -0,0 +1,20 @@ +const riot = require('riot'); + +module.exports = me => { + riot.mixin('i', { + init: () => { + this.I = me; + this.SIGNIN = me != null; + + if (this.SIGNIN) { + this.on('mount', () => { + me.on('updated', this.update); + }); + this.on('unmount', () => { + me.off('updated', this.update); + }); + } + }, + me: me + }); +}; -- cgit v1.3.1-freya