Development Tips & Tricks

  • plamzi
  • plamzi's Avatar Topic Author
  • Offline
  • Administrator
More
20 Nov 2013 03:08 #1 by plamzi
Development Tips & Tricks was created by plamzi
Once you get familiar with the Web App API , probably the next thing you should know is how to access the external libraries that are "underneath" the app and can make your life a whole lot easier:
  • jQuery - The jQuery library is available under the global namespace "j" because other libraries you may wish to load and use commonly claim the $ namespace. It's used everywhere, and for a good reason.
  • Bootstrap - The Twitter Bootstrap library allows you to create neat UI elements just by following specific HTML / CSS markup rules, or by calling its UI methods on existing HTML elements. It is used heavily by app modules so if you're not familiar with it, looking at module examples is going to help.
  • D3.js - The Data Driven Documents library is an advanced visualization tool that can draw and animate vector-based SVG from any data set. There's a steep learning curve, but without it JujuMapper would not have been possible.
  • NiceScroll - A jQuery plugin that makes scrollbars pretty, and optionally mimics touch scroll behavior.

One thing to keep in mind is that, while the examples show you how to build modular plugins, you can certainly start smaller and in a less organized way. Just try hooking functions directly to the various events the app fires and see what happens:
Event.listen('before_process', function(d) {
alert('Here is what we received from the server: '+d);
});

Post your code to the Private category, or leave it unpublished under Official and force it to load with "&dev=1". It will not affect other users until it is published in Official, and associated with the game you are developing for using meta keywords ( more here ).

Remember to add "&debug=1" to the app URL to get a much better view of what different modules are doing. Messages will be logged to the browser console, which can be viewed with a debugger specific to your preferred browser, like Firebug for Firefox.

You can add your own logging by calling the utility function "log(txt)". It will not log anything to the console unless debug=1 is set either as a URL parameter, or on the page with "Config.debug = 1".

To Be Continued...
The topic has been locked.