Lit BAMF - Firescar96/lit GitHub Wiki
This is a guide to the structure of Lit-BAMF to aid current and future developers in making contributions.
-
client/ contains all the source files that need to be processed by webpack before they can be read by the browser
- js/ contains all the javascript source files
- sass/ contains all the styling source files
-
public/ contains any files that do not need processing by webpack can go here
-
images/ every
<image>in this folder will be accessible at the path/images/<image> -
js/ webpack places a single file,
main.js, in this directory containing all the compiled, minimized, and bundled javascript code -
style/ webpack places a single file,
main.css, in this directory containing all the minimized css styles - index.html imports the bundled js and css files from the local server; it also imports other necessary web frameworks such as Reactjs via cdn
-
images/ every
- .eslintrc this is a fairly comprehensive javascript styling guide, most editors that support linting will automatically find and read this file
- .gitignore self explanatory
- package.json this should be familiar to any javascript developer, it includes packages necessary for building Lit-BAMF
-
server.go most page routing happens client side so excluding paths prefixed with
ws,images,js, andstylethe server simply responds with the index.html - webpack.config.js this configuration specifies how to build the js and sass files
Convention is to name files that export a class in uppercase and other files in lowercase. Each of the exported classes are detailed via the links in the sidebar. Each page has it's own class as well as components of Lit-BAMF that need to be accessed by multiple pages. Most other style conventions are codified in the .eslintrc file.
Lit-BAMF depends on multiple third party libraries to run in the browser. The following is an overview of what they are and where they are used.
Most of the imports for Lit-BAMF are the components of React. React is a library for building user interfaces. By merging together html and JavaScript, it allows for a closer relationship between user actions and view the view. It's used to provide dynamic updates based on user iteraction, such as automatically refreshing the list of addresses when a user creates a new address. It is also used to provide reuseable components, such as the Navbar, which is imported by each page.
Reflux is an extension of React which allows state to be easily shared between react components. State refers to all values on a page which might change and need to be dynamically updated. This is required for the Channels page which has multiple React components on the page and in modals which need to be able to interact with a unified state.
Q is such a useful library that it has claimed a single letter name among javscript libraries. Promises are a useful JS paradigm, they turn what would normally be a blocking or synchronous call into an asynchronous one. Q is integrated into the way Lit-BAMF handles RPC calls so that multiple calls can be made simultaneously without blocking. Using promises also allows for more elegant handling of errors because of the way Q functions are phrased using natural language.
Although Lit has the capability to support multiple blockchains, Lit-BAMF currently only supports the Bitcoin Testnet4.