trans

trans module

trans module provides 2 methods to call between functions,Where the send_inline method requires user authorization and send_context_free_inline does not。

Static function

send_inline

send inline action to specific account

1
trans.send_inline(account,name,args,authorization);

Parameter Usage:

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// hi acction
exports.hi = (user, friend) => {
// Trigger hi2 action
trans.send_inline(
'test',
'hi2',
{
user: user,
friend: friend
},
[{
actor: user,
permission: 'active'
}]
)
};

// hi2 action
exports.hi2 = (user, friend) => {
console.log(user, friend);
}

send_context_free_inline

send context_free inline action to specific account

1
trans.send_context_free_inline(account,name,args):

Parameter Usage:

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// hi acction
exports.hi = (user, friend) => {
// 触发hi2 action
trans.send_context_free_inline(
'test',
'hi2',
{
user: user,
friend: friend
}
);
};

// hi2 action
exports.hi2 = (user, friend) => {
console.log(user, friend);
}