Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

CompositionalIT/simple-fable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fable Minimal App

This is a minimal Fable sample application based off of the Fable dotnet template.

  1. Run npm install.
  2. Run dotnet build src.
  3. Run the app with node_modules\.bin\webpack-dev-server.

Points of interest

  1. Observe the file is normal F#, with modules and open statements.

  2. We can get a reference to a DOM element using standard DOM browser functions. These are simple F# wrappers around the browser.

  3. This includes event handlers.

  4. We can even use window.alert!

  5. We can even use some BCL methods that can magically "transpiled" to equivalent JS methods e.g. DateTime.

  6. We can reference modules of other JS files e.g. NPM packages easily using the import function

  7. We can go even lower and use the Emit attribute.

  8. Or we can create an interface to match the JS module.

  9. If we're feeling dangerous we can do complete dynamic typing using the ? operator.

There is a website called TS2Fable which attempts to massage TS definitelytyped interfaces into F#.

See also here for more details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published