techpines / bone.io Goto Github PK
View Code? Open in Web Editor NEWRealtime HTML5 Framework
Home Page: bone.io
License: Other
Realtime HTML5 Framework
Home Page: bone.io
License: Other
We need a build system to generate the javascript files in the top level directory of the project from the index.coffee file.
I'd like to use grunt, http://gruntjs.com/
Basically, in the top-level directory of the project. We want to get two files:
/bone.io.js
/bone.io.min.js
I wanted a default route to run if there was not a match found. My route root can be defined in the module and is set on page render through bone.router.start({root:resp.path,pushState: true})
. I was running into issues finding a simple work around.
My first question is am I overlooking something simple here?
If not, this is the solution I am using to add a catchall regex route. Is there a better way?
Add a defaultRoute as the last route:
'*': defaultRoute
and update routeToRegex:
routeToRegex = function(route) {
var escapeRegExp, namedParam, optionalParam, splatParam;
if(route === '*') {
return new RegExp("([^\s]+)");
}
optionalParam = /\((.*?)\)/g;
namedParam = /(\(\?)?:\w+/g;
splatParam = /\*\w+/g;
escapeRegExp = /[\-{}\[\]+?.,\\\^$|#\s]/g;
route = route.replace(escapeRegExp, "\\$&").replace(optionalParam, "(?:$1)?").replace(namedParam, function(match, optional) {
if (optional) {
return match;
} else {
return "([^/]+)";
}
}).replace(splatParam, "(.*?)");
return new RegExp("^" + route + "$");
};
Shouldn't this be a closet
?
(Get it, skeleton, closet?... j/k feel free to close)
I put together an example to test out bone.io's pub/sub capabilities with the room functionality. I followed the example found on the website 'http://bone.io/#io/pub/sub'
I got the error below, stating that the object function does not have a method 'room'. It could be possible that I'm using it wrong, though I did base my test off the code from the site.
If you wish to see the code that triggers the error, I have it up in a repo and that specific file/line can be found here:
The error:
/home/spectrum/quick-hapi-bone.io/index.js:45
this.room(data.room).broadcast({ message: data.message });
^
TypeError: Object function (socket) {
return createIO(socket, options);
} has no method 'room'
at Function.bone.io.inbound.send (/home/spectrum/quick-hapi-bone.io/index.js:45:10)
at /home/spectrum/quick-hapi-bone.io/node_modules/bone.io/lib/node/io.coffee:107:24
at Object.async.eachSeries (/home/spectrum/quick-hapi-bone.io/node_modules/bone.io/node_modules/async/lib/async.js:127:20)
at Socket.<anonymous> (/home/spectrum/quick-hapi-bone.io/node_modules/bone.io/lib/node/io.coffee:101:22)
at Socket.EventEmitter.emit [as $emit] (events.js:95:17)
at SocketNamespace.handlePacket (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/namespace.js:335:22)
at Manager.onClientMessage (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/manager.js:488:38)
at WebSocket.Transport.onMessage (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transport.js:387:20)
at Parser.<anonymous> (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:39:10)
at Parser.EventEmitter.emit (events.js:95:17)
at finish (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:288:16)
at Parser.expectHandler (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:299:15)
at Parser.add (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:466:24)
at Parser.expect (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:499:10)
at Parser.<anonymous> (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:298:18)
at Parser.add (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:466:24)
at Parser.expect (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:499:10)
at expectData (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:296:16)
at Parser.opcodeHandlers.1 (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:313:9)
at Parser.processPacket (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:533:8)
at Parser.add (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:466:24)
at Parser.expect (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:499:10)
at Parser.endPacket (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:553:8)
at finish (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:291:14)
at Parser.<anonymous> (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:299:15)
at Parser.add (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:466:24)
at Parser.expect (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:499:10)
at Parser.<anonymous> (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:298:18)
at Parser.add (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:466:24)
at Parser.expect (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:499:10)
at expectData (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:296:16)
at Parser.opcodeHandlers.1 (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:313:9)
at Parser.processPacket (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:533:8)
at Parser.add (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:466:24)
at Socket.<anonymous> (/home/spectrum/quick-hapi-bone.io/node_modules/socket.io/lib/transports/websocket/hybi-16.js:141:17)
at Socket.EventEmitter.emit (events.js:95:17)
at Socket.<anonymous> (_stream_readable.js:720:14)
at Socket.EventEmitter.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:392:10)
at emitReadable (_stream_readable.js:388:5)
at readableAddChunk (_stream_readable.js:150:9)
at Socket.Readable.push (_stream_readable.js:113:10)
at TCP.onread (net.js:511:21)
Thank you for your time
Also, nothing about doing pushState and how to start history with:
bone.history.start()
Hi! bone.io looks really interesting. I did some work with NodeJS, but I still need to use other server-side programming languages and technologies for other stuff. Mostly I've been using SockJS and it's various implementations on top of other servers.
For now, bone.io seems to work with socket.io and on top of NodeJS (correct me if I'm wrong). Is there a plan for create a "pluggable" system, where I can map bone.io calls to SockJS (just an example) and then make it work with my own technologies? That would be really interesting.
Best regards,
Richard.
I stumbled upon this framework, and it seems to fill a niche my team has been missing.
I've noticed that express seems to be the maine framework for this project, at least based on the available documentation. Does bone.io has support for switching out frameworks, or some sort of framework-agnostic approach of usage?
Thanks for creating bone.io. I look forward to seeing where this project goes, and being a user.
We need an event logger!
Four types of events:
And here would be sample output for each:
Data: [Source:Action]
Interface: [Selector:EventName]
View: [Selector:Action]
Just go in and add console.log
statements to lib/index.coffee
.
I need to setup the test harness, and then we need to start testing.
In https://github.com/techpines/bone.io#templates
In the examples you have
bone.mount('#sidebar', 'list', {data: 'hello', refresh: true});
It is not documented what refresh:true
does
Great framework. Just curios to see if there is a scaffolded template to start a new project with?
Create data.json
file.
Should look something like this:
module.exports = [...]
Then in app.js
, you would require it:
var list = require('./data');
I have just come across this library and wanted to know if it is still being maintained?
In this example, clicking the link will redirect user to a 404 page.
<a href="/search/ohhyea">search</a>
<script>
bone.router({
routes: {
"/search/:query": "find"
},
find: function(query, data) {
alert(query);
}
});
bone.router.start({pushState: true});
</script>
In this example, if you click link route will fire twice:
<a href="#search/ohhyea">search</a>
<script>
bone.router({
routes: {
"search/:query": "find"
},
find: function(query) {
alert(query);
}
});
bone.router.start();
</script>
I saw bone.io is quite similar to backbone.js for some aspect like router and views. Why has been decided to not provide a built in support for models and collections?
Is there another way to manage data structures? Have I to rely only on bone.io feature for that?
Otherwise leads to strange code.
as client
<script> socket = io.connect(); bone.set('io.options', { socket: socket }); </script>how to send chat message ?
We need to start writing some documentation for this bad boy.
To edit the docs, make changes to README.md
.
If you need examples of how the readme syntax works look here:
This is what it renders like:
https://github.com/techpines/express.io/blob/master/README.md
Here is what the code looks like:
https://raw.github.com/techpines/express.io/master/README.md
As a first pass it would be nice to document the views
, logger
, and io
parts of the lib.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.