-
Notifications
You must be signed in to change notification settings - Fork 0
Client
The client-side framework provides a structured and scalable modularization of the front-end user experience fully backed up by jQuery and underscore.
- jQuery: v1.10.2
- underscore: v1.5.2
- socket.io: ~0.9.16 (from the Socket server)
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>
The sandbox controls the data processing and distribution between the backend application, the environment and the application modules.
-
Broadcast: Used to implement a publisher/subscriber pattern between the application and its modules.
Roadmap: Using the socket server, merge the backend and the frontend as one big publsher/subscriber pattern.
-
sandbox.broadcast.publish(event, data)
-
sandbox.broadcast.subscribe(event, callback)
-
sandbox.broadcast.unsubscribe(event, callback)
-