Emu is a collection of patterns and utitlities that I have settled on in all the node based web apps I've built.
It uses raw EC6 modules on the frontend with no Typescript or bundling.
The main reason for building it was the clientside Model class, which allows for generating 'create' and 'edit' forms automatically from whatever your Model is.
Two javascript classes for passing objects easily through many forms on both client and server. Use these two abstract classes for the basic needs of handling large amounts of user input very quickly. The particular focus is on creating generic, unstyled clientside forms - CSS and extra bindings are up to you.
The client class mainly provides methods for building forms, accepting input, and posting to server.
- The generated form will
preventDefault
standard submit, and will fire the Model'sonsubmit
method (intended for user middleware) before firing it's ownsubmit
.
- enum
type
- 'data' or 'form' -
- data: hydrate from other objects or Models as
source
s
- data: hydrate from other objects or Models as
-
- form: attempt to hydrate a Model from a given DOM form as
source
, or it's internal form if none is provided.
- form: attempt to hydrate a Model from a given DOM form as
- post data directly from the model as opposed to from a form element
- a method for saving or updating, with a togglable
upsert
allowed boolean.
- return all fields marked as public info
- optionally return more private fields where server logic determines it's appropriate
Utilities are standalone modules with their css bundled directly into them so they are one-line includes in any module based app. Examples are found commented at the top of each utility.
A popup / system message (taken from 2001 Space Odyssey HAL)
A waiting spinner, easily targeted to individual elements or the whole page
A small wrapper around js fetch
that assumes you are either GET'ting a route of POST'ing JSON. Returns a Promise
SVG pie charts that animate when scrolled to.
These are apps I've built using the tools in Emu:
https://eccentricity.online
https://game-scry.online
https://coilconnect.org
https://emu.oko.nyc