-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A Few Newb Questions #138
Comments
Hey @FiatPax, I can probably answer these. For number 1, I'd likely wrap the Box.Application.addService('NeDB', function(app) {
return {
init: function() { /* intialize NeDB stuff here */ }
}
}); If you think you'll have multiple modules that need to init the database drivers on the same page in different ways then I'd look at making your service perform like a factory. The services api documentation has a good reference on doing that. (Look under patterns/factory). As for your second question, that's fairly easy. Behaviors can do just about everything a module can do. Ultimately behaviors are how you share reusable functionality between modules. That means if you have a signup button that appears in a couple of your modules you can implement the functionality of what it does on click in a behavior and then share that between modules. A service on the other hand is just a general, reusable utility. You'd use it to wrap your database driver, or to handle loading in asynchronous content. I'd recommend you read through all three sections of the documentation. The getting started part gives you a bit of information but the guides and api sections are really where you get into the meat of it. |
Hello @zephraph , thank you! Your answer has cleared my problems fair enough. |
No problem. Feel free to close the issue if you have no more questions. 😄 |
@zephraph Sure :) |
Thanks @zephraph , very well explained! |
👍 |
Hello,
Firstly thanks for this awesome project, I am not a very experienced developer but the simplicity of this and easily understandable explanations got me interested in this project and I like it.
However I have a couple of questions:
Thanks
The text was updated successfully, but these errors were encountered: