PURE with your JS library

PURE integrates, out of the box, with the following JS libraries:

Description of the jQuery Methods added by pure.js

jQuery( ... ).render

jQuery( ... ).render( data, directives )
Input:

  • jQuery( ... ): makes an instance of the jQuery function as you do normally. You can use $( ... ) too.
  • data: is the JSON data we want to render
  • directive: This is the commands we want PURE to perform. See more info about directive here
Output:
the input DOM node html is replaced with the result of the transformation.

jQuery( ... ).autoRender

jQuery( ... ).autoRender( data [, directives] )
Input:

  • jQuery( ... ): makes an instance of the jQuery function as you do normally. You can use $( ... ) too.
  • data: is the JSON data we want to render
  • directive [optional]: a directive are additional commands, when the class attributes are not enough. i.e.: function directives
Output:
A jQuery object is returned (that can be chained), and the node selected by the $( ... ) is replaced with the result of the transformation.

jQuery( ... ).compile

compile converts an HTML node to a JS function using a directive.
Or as with autoRender, with data and map automatically CLASS attributes.

jQuery( html ).compile( directives [, data] )
Input:

  • jQuery( ... ): makes an instance of the jQuery function as you do normally. You can use $( ... ) too.
  • directive: a directive are additional commands, when the class attributes are not enough. i.e.: function directives
  • data [optional]: is the JSON data we want to render
Output:
function: This method compiles the HTML template to returns a JS function.
This returned function can be executed on the JSON data we want to render.

var rfn = $p( 'div' ).compile( dir );
result.innerHTML = rfn( data );