Skip to content

lazyposse/fnx

Repository files navigation

Development

This section discuss the internals of fnx, intended for developers.

History management

What we want

Browser back button should works as expected

For example navigating in a ns, and then going back should bring the previous ns.

Bookmarking a namespace

For example:

  • Navigate to the ns foo/bar/
  • Bookmark it
  • Then when opening a new page with the bookmark should display the content of foo/bar/.

Bookmarking functions

Same as below but with functions.

Bookmarking functions with arguments

For example:

  • Navigate to a fn
  • Fill the parameter
  • Bookmark the page
  • Open a new page with the bookmark
  • Then the page should display the function form with the fields populated with the same values than when bookmarking

Bookmarking functions with partially filled arguments

Same as below, but should also works with partially filled arguments.

Implementation details: Could be implemented by listening to the blur event of text fields and updating the URL accordingly.

Bookmarking functions calls

For example:

  • Navigate to the fn foo/bar/hello-world, which is a function that takes a single parameter name.
  • Fill the name field with john.
  • Hit the run button: The result of the function is displayed: Hello, john.
  • Bookmark the page
  • Then when opening a new page with the bookmark should display “Hello, john=, as well at the form of the function with the field name populated with the value john.

Solution

All the functionalities described below could be implemented by using the history management capability of ClojureScript One.

That is using the web browser address bar to save the state that we want to restore later.

Informations to serialize

The app could be in the following “states” (activities):

  • navigating ns: ns-navigating
  • display fn form: fn-form-displaying
  • run fn: fn-running
statenecessary additionnal informations
ns-navigatingcurrent-ns
fn-form-displayingcurrent-fn, fn-args
fn-runningcurrent-fn, fn-args
fn-result-showingfn-result

Summary of the state of the app

statekeyvaluesin URL?
statens-navigating,yes
fn-form-displaying,
fn-running,
fn-result-showing
current-nsnsyes
current-fnfnyes
fn-argsfn args
(could be
incomplete)yes
fn-resultany data cljno
datastructure
hierarchy of all ns and fnall-nsa map of ns/fnno

Running development [71%]

Learn one [100%]

Learn the inner working of one

Checkout one

Setup [100%]

Add the files to scan for redeploying the app src/app/one/sample/config.clj

Server side [100%]

Expose functions

Execute functions

Extract metadata functions

Deal with function order in parameters

Client side [76%]

Init view

Init model

Deal with spinner

Display the list of first level namespaces

Navigate through namespaces

Navigate to the upper level of the current namespace

Display the namespaces and the functions

Retrieve the metadata of the function and display them via forms (arity)

Run the function basically

Beware the order of the arguments of the function

Edge cases (check the inputs)

Deal with varargs in the view &

Deal with history [33%]

ns-clicked

fn-clicked

input-clicked

Design [0%]

Improve ui in general

Add animations !!!

Improve spinner (deal with opacity)

Deploying [100%]

Midje dev-dependencies to dependencies in the project.clj

Actually deploy to heroku

Doc about it

Marginalia [100%]

Deploy doc

notes [%]

common prefix may be possible if 2 jar start with the same prefix ns