naja-js / naja

Modern AJAX library for Nette Framework
https://naja.js.org
MIT License
109 stars 16 forks source link

Add examples to documentation #211

Closed jiripudil closed 3 years ago

jiripudil commented 3 years ago

I'd like to expand the documentation with examples, on two distinct levels:

  1. Current documentation pages are a bit abrupt at places. They use natural language to explain various features and how to use them, but neglect the language that developers speak best: code. I'd like to add short code snippets showing each feature in action, such as e.g. here.

  2. Some problems are more universal than others across a range of websites and applications. It's apparent developers would benefit from an examples section, featuring ready-made solutions for common real-world use cases. I'd like this section to have some kind of structure though, so that it doesn't become a pile of random code snippets. Several categories come to mind, including:

    • Installation: more thorough examples of basic setup: direct usage, loading from CDN, bundling with NPM and Webpack (with a special note about contributte/datagrid), ...
    • Data processing: sending various common types of data such as objects, arrays, files and blobs, JSON, ...
    • User feedback and interaction: manual dispatch, confirmation dialogs, spinners, scroll position preservation, ...
    • Integration with 3rd party scripts: tracking pageviews in analytic tools, reinitializing scripts such as social media widgets, binding Naja's behaviour to dynamically added elements, ...
    • Snippets: infinite scrolling, changing update operation, changing snippet update implementation, ...
    • History: using (and disabling) UI cache, when to use replace mode, ...

    Feel free to share your ideas!

dakur commented 3 years ago

I suggest make some examples of how to ajaxify a form in Forms section. I was expecting it there and found just something about integration of nette forms.. 🙂