Click to show TOC

Example of Modularizaion

I am going to see how to modularize a try example into multiple files.

While we are here we can demonstrate how to display data, amd show how to incorporate into a new file (in a sub directory modular)

Displying data

The simplest way of displaying data is to end the script with a expression that returns a value that is not undefined.

 
 
     

Displaying and may values

If we need to display display and other points of the script at ponts other than at the end, we need a display function, for example console.log

  • $$.D(exp1,exp2…) Display Javascript expression results
  • $$.HTML(str) Display string as HTML
  • $$.json(expr) Display data as JSON string

Displaying Javascript Data $$.D

First we will use the $$.D to display Javascript expressions. This function is very similar to console.log(expr1, expr2)

 
 
     

Displaying HTML from string

Here we will show how to render some HTML. In order to support remdering, TryITjs uses Semantic-UI




Page - 1