working on the peer api...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-02-19 05:55:53 +03:00
parent 4b32f370ba
commit 07d3ca21ef
3 changed files with 20 additions and 4 deletions

View File

@ -17,6 +17,7 @@ require('features/location')
require('features/recover') require('features/recover')
require('features/history') require('features/history')
require('features/app') require('features/app')
require('features/peer')
require('features/ui') require('features/ui')
require('features/ui-partial-ribbons') require('features/ui-partial-ribbons')
require('features/ui-single-image') require('features/ui-single-image')

View File

@ -280,6 +280,9 @@ var IntrospectionActions = actions.Actions({
.isUserCallable(<action-name>) .isUserCallable(<action-name>)
`, `,
// XXX should this check only the root action or the whole set???
//function(action){
// return this.getActionAttr(action, '__not_user_callable__') != true }],
actions.doWithRootAction(function(action){ actions.doWithRootAction(function(action){
return action.__not_user_callable__ != true })], return action.__not_user_callable__ != true })],
}) })

View File

@ -22,7 +22,9 @@ var core = require('features/core')
// Protocols: // Protocols:
// - child_process // - child_process
// - http // - http
// - rpc/mq // - rpc
// - mq
// - ...
var PeerActions = actions.Actions({ var PeerActions = actions.Actions({
// XXX need more control... // XXX need more control...
@ -32,8 +34,18 @@ var PeerActions = actions.Actions({
getPeerActions: ['- Peer/', getPeerActions: ['- Peer/',
function(id){ function(id){
// XXX var that = this
return this.actions.filter(id ?
function(action){
return that.getActionAttr(action, '__peer__') == id }
// get all peer actions...
: function(action){
return that.getActionAttr(action, '__peer__') })
}], }],
// XXX should this also check props???
isPeerAction: ['- Peer/',
function(name){
return !!this.getActionAttr(name, '__peer__') }],
peerCreate: ['- Peer/', peerCreate: ['- Peer/',
function(){ function(){
@ -48,12 +60,12 @@ var PeerActions = actions.Actions({
peerConnected: ['- Peer/', peerConnected: ['- Peer/',
core.notUserCallable(function(){ core.notUserCallable(function(){
// XXX // XXX
}], })],
// event... // event...
peerDisconnected: ['- Peer/', peerDisconnected: ['- Peer/',
core.notUserCallable(function(){ core.notUserCallable(function(){
// XXX // XXX
}], })],
peerList: ['- Peer/', peerList: ['- Peer/',
function(){ function(){