forked from cory/tildefriends
1.2 KiB
1.2 KiB
Writing Tilde Friends applications7
TODO
Creating your environment
- Open an existing application (ie:
identity
); - Open the editing panel;
- Save the app under a new name (ie
/~YOUR_USERNAME/my-app/
); - Go back to the main menu and open your new app;
- You can now edit your app, save it and see changes in the real time.
Project structure
An application has a app.js
file that gets run when a user enters the app.
This file contains a function (typically called main()
) that's considered the entry point.
Paste this in app.js
:
async function main() {
let ids = await ssb.getIdentities();
await app.setDocument(`
<body style="font-family: sans-serif; color: white">
<h1>Hello world!</h1>
</body>
</body>`);
}
main();
Save the app, and you should now be seeing Hello world!
on the screen.
Components
Once your app grows to a certain size, you'll want to introduce components. In Tilde Friends, the de facto standard is Lit. Althogh you an use any framework you want, you're encouraged to use Lit as you can reuse
First, add lit-all-min.js into your project.
TODO
TODO: tfrpc
Apps can interact with Tilde Friends using tfrpc.
Read <tfrpc.md>
TODO: sharing apps