Single page web app framework, scoket.io
events <> Event Handlers.
For Server Framework check NeoNode
Important changes: new Event API (Wdiget events <-> backend handler) system
New handler pattern added
[Express] "/"
-> index.html (with config object printed)
[Socket.io client] connect + clientId
> server.clients[clientId] = new ClientHandler({socket: socket});
Full evented api over socket.io.
Every App will have a front-end client and an AppHandler on the back
[client] -[socket.io event + .data]-> [server AppHandler] has handlers for all events.
$ git clone [email protected]:escusado/telemetry.git
$ npm install
$ bower install
It will rename all the info and code strings to the projectname.
ej.
//instead of default
window.app = new App();
//will transform to
window.app = new ProjectName()
//It will rename also:
'lib/app/AppHandler.js' to 'lib/app/ProjectNameHandler.js'
'public/js/app/App.js' to 'public/js/app/ProjectName.js'
npm run rename_app
or
npm run rename_app -- -n project-name-separated-by-hiphens
If no nanme is passed name and repo will be grabbed from the .git folder
$ npm run rename_app
> [email protected] rename_app /Users/Toily/code/my-new-project
> node bin/tasks/rename_app.js
> Getting name from git repo...
> Git repo: { name: 'my-new-project',
repository: '[email protected]:escusado/my-new-project.git' }
> Camelized name: MyNewProject
> Content updated
> File Written: package.json
> File Written: bower.json
> File Written: README.md
> File Written: bin/server.js
> File Written: lib/app/AppHandler.js
> File Written: public/js/app/App.js
> File Written: views/index.html
> Renamed lib/app/AppHandler.js to lib/app/MyNewProjectHandler.js
> Renamed public/js/app/App.js to public/js/app/MyNewProject.js
> Project uccesfully renamed to: my-new-project
Edit config/server.json config/client.json
client.config gets to frontend App.js
as .config where you can consume it.
Connection and reconnection is handled by the NeBootstrapClient.js
Class.
A simple identity is created per client to handle reconnect and socket instance sync.
printed in the config
template variable on index.html
npm start
- New jQueryless Widget (based on the Horror one)
- Added start script
npm start
- Added rename project feature task (changes relevant strings and filenames to replace 'neon-bootstrap' to 'project-name') defailts to .git contents
- New Event API philosophy (frontend
Widgets
, emit events (socket.io) to anAppHandler
, that contains all handlers for them). - Client disconnect management through the
.reconnect(<new socket>)
method.
- Build system a'la neonode global tool and an initter