Skip to content
Luis Eduardo Brito edited this page Sep 16, 2013 · 10 revisions

The client-side framework provides a structured and scalable modularization of the front-end user experience fully backed up by jQuery and underscore.

External Libs

  • jQuery: v1.10.2
  • underscore: v1.5.2
  • socket.io: ~0.9.16 (from the Socket server)

Core

The Core Class controls the app environment and abstracts the browser integration with the external libs, making the modules and controllers support full code recycling.

  • core.log.info(message)

    Log some variable or message string to the default log endpoint (currently the browser console).

  • core.log.error(message)

    Throw some variable or message string to the default error endpoint (currently the browser console).

    Roadmap: Implement silent and external logging through the socket connection.

  • core.client([sel])

    The client class, responsible for abstracting the whole browser and html integration. It wraps the jQuery library and integrate with some methods from underscore.

    So you can do something like:

    // returns the body content
    client("body").html();
    
    // return some input value
    client("input#email").val();
    • core.client.render(controller, data)

    Render a controller into the default controller endpoint, defined by the data-endpoint="controller" html attribute.

    Template:

    <div data-endpoint="controller"></div>
    
    <script data-controller="home" type="text/template">
      Hello <%= name %>!
    </script>

    Javascript:

    // renders in the controller endpoint div: Hello John!
    client.render("home", {name: "John"});

    Result:

    <div data-endpoint="controller">Hello John!</div>

Sandbox

Clone this wiki locally