mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-23 21:43:09 +02:00
✌️
This commit is contained in:
parent
33cf762211
commit
168b5bb723
3 changed files with 21 additions and 14 deletions
|
@ -3,7 +3,7 @@ riot = require \riot
|
|||
module.exports = (me) ~>
|
||||
i = if me? then me.token else null
|
||||
|
||||
(require './scripts/i.ls') me
|
||||
(require './scripts/i') me
|
||||
|
||||
riot.mixin \api do
|
||||
api: (require './scripts/api').bind null i
|
||||
|
|
20
src/web/app/common/scripts/i.js
Normal file
20
src/web/app/common/scripts/i.js
Normal file
|
@ -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
|
||||
});
|
||||
};
|
|
@ -1,13 +0,0 @@
|
|||
riot = require \riot
|
||||
|
||||
module.exports = (me) ->
|
||||
riot.mixin \i do
|
||||
init: ->
|
||||
@I = me
|
||||
@SIGNIN = me?
|
||||
|
||||
if @SIGNIN
|
||||
@on \mount ~> me.on \updated @update
|
||||
@on \unmount ~> me.off \updated @update
|
||||
|
||||
me: me
|
Loading…
Reference in a new issue