All checks were successful
		
		
	
	Build Tilde Friends / Build-All (push) Successful in 19m18s
				
			
		
			
				
	
	
	
		
			2.2 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	
			2.2 KiB
		
	
	
	
	
	
	
	
Tilde Friends Cheat Sheet
Making apps for the impatient tilde friend.
Prerequisites
- either run your own instance or use tildefriends.net
 - register and login
 - [optional] use the 
ssbapp to create yourself an SSB identity 
Development Process
- hit the 
editlink from any app or new app URL - make sure the path in the text box is under your username: 
/~username/app/ - write server-side code in 
app.js - click the 
savebutton or press the save hotkey (Alt+S or [browser-specific modifiers]+S) - see the app reload on the right side
 
Output
app.setDocument(html)- send HTML to the browserprint(...)- send values to the browser's developer console
Persistence
app.localStorageGet(key)->valueapp.localStorageSet(key, value)database(),shared_database(key),my_shared_database(package, key)db.get(key)->valuedb.set(key, value)db.exchange(key, expected, value)->exchangeddb.remove(key)db.getAll()->[key1, ...]db.getLike(pattern)->{key1: value1, ...}
SSB
ssb.createIdentity()->idssb.getIdentities()->[id1, ...]ssb.appendMessageWithIdentity(id, content)->message_idssb.blobStore(blob)->blob_idssb.blobGet(id)->blobssb.sqlAsync(query, args, row_callback)
TF-RPC
Stock helper code for calling functions across the web server and browser boundary.
- on the server: 
import * as tfrpc from '/tfrpc.js'; - in the browser: 
import * as tfrpc from '/static/tfrpc.js'; - either direction:
- register a function: 
tfrpc.register(function my_function() {}); - call a remote function: 
let promise = tfrpc.rpc.my_function(); 
 - register a function: 
 
Share
- give out web links: https://www.tildefriends.net/~cory/screwble/
 - use the 
Attach Appbutton when composing a post in the SSB app