mirror of
https://iceshrimp.dev/iceshrimp/iceshrimp
synced 2024-12-05 02:08:08 +09:00
✌️
This commit is contained in:
parent
9e6108f3e2
commit
f9058cb739
@ -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 New Issue
Block a user