Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Intro to MontageJS

Ryan Paul
January 27, 2014

Intro to MontageJS

An introductory overview of MontageJS, a JavaScript MVC framework for frontend development.

Ryan Paul

January 27, 2014
Tweet

More Decks by Ryan Paul

Other Decks in Programming

Transcript

  1. • Framework for frontend web development • Ideal for building

    single-page applications • Best suited for projects that target modern browsers • Open source, under BSD license What is MontageJS?
  2. Filesystem assets images style node_modules digit montage ui main.reel welcome.reel

    index.html package.json ! main.reel main.html main.css main.js
  3. Serialization • Instantiate components • Attach components to the page

    DOM • Populate component properties — static values or bindings
  4. FRB Bindings • Propagate changes between object properties • Can

    be 1-way or 2-way • Bind to other components or regular JS objects
  5. Serialization "number": { "prototype": "digit/ui/number-field.reel", "properties": { "element": {"#": "number"}

    } } <input data-montage-id="number" /> HTML MJS Prototype: path to the desired component
  6. Serialization "number": { "prototype": "digit/ui/number-field.reel", "properties": { "element": {"#": "number"}

    } } <input data-montage-id="number" /> HTML MJS Element: Montage ID of DOM element
  7. "number": { "prototype": "digit/ui/number-field.reel", "properties": { "element": {"#": "number"} }

    }, "slider": { "prototype": "digit/ui/slider.reel", "properties": { "element": {"#": "slider"} }, "bindings": { "value": {"<->": "@number.value"} } } Adding a 2nd component <input data-montage-id="number" /> <input data-montage-id="slider" type="range" /> HTML MJS
  8. "number": { "prototype": "digit/ui/number-field.reel", "properties": { "element": {"#": "number"} }

    }, "slider": { "prototype": "digit/ui/slider.reel", "properties": { "element": {"#": "slider"} }, "bindings": { "value": {"<->": "@number.value"} } } <input data-montage-id="number" /> <input data-montage-id="slider" type="range" /> HTML MJS <-> signifies a 2-way binding
  9. "number": { "prototype": "digit/ui/number-field.reel", "properties": { "element": {"#": "number"} }

    }, "slider": { "prototype": "digit/ui/slider.reel", "properties": { "element": {"#": "slider"} }, "bindings": { "value": {"<->": "@number.value"} } } <input data-montage-id="number" /> <input data-montage-id="slider" type="range" /> HTML MJS @ references an existing component
  10. ! "sorted": {"<-": “numbers.sorted{}”} ! "evens": {"<-": “numbers.filter{!(%2)}”} ! "low":

    {"<-": “numbers.filter{this <= ^maxNumber}”} ! "allChecked": {"<-": “options.every{checked}”} ! "payroll": {"<-": “departments.map{employees.sum{salary}}.sum()”} ! "index": {"<-": “folks.group{id}.sorted{.0}.map{.1.last()}”} MJS Fun with FRB
  11. • Command line tool that optimizes apps for production deployment

    • Consolidates code into bundles to reduce number of requests • Minifies code to reduce total download size MontageJS Optimizer