1import ob from 'urbit-ob';
3import { ensurePatFormat } from 'form/formatters';
5// looks into the window context to find a "flow command", an object indicating
6// if bridge is to be used for one specific flow.
7// expects to find objects of the following shape, varying by kind:
10// as: '~ship', // who to send the invite as
11// ship: '~ship', // what planet to send as the invite
12// email: 'ex@amp.le' // email to send the invite code to
15// you may optionally include .success() and .failure(reason) callbacks.
21const useFlowCommand = () => {
22 let flow = window.flow;
24 if (typeof flow === 'object') {
25 flow.success = flow.success || (() => {});
26 flow.failure = flow.failure || (() => {});
29 flow.as = ensurePatFormat(flow.as);
30 flow.ship = ensurePatFormat(flow.ship);
31 if (!ob.isValidPatp(flow.as) || !ob.isValidPatp(flow.ship)) {
32 console.log('invalid inviting flow arguments', flow.as, flow.ship);
38 console.log('unrecognized kind of flow:', flow.kind);
49export { COMMANDS, useFlowCommand };
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list