Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
AJMax is a micro-framework, which simplifies the development of one-page Ajax applications with node.js.
It has a light-weight HTML-template engine, which performs data-binding on the client side very efficiently.
It effectively enforces MVC architecture, where Model is JSON-based REST API, View is HTML templates, and Controller is written in JavaScript and/or JSON, running either on the client side or the server side (or both).
It allows developers to describe data-binding instructions (and controll behaviors) in JSON instead of JavaScriptz, which simplifies the development, and also makes it possible to describe those instructions on the server side and send them to the client to be executed (remote data-binding and DOM manipulation).
For example, the following code (which runs either on the client side or the server side) fetches the JSON data that describes 'me' using Facebook Graph API, and binds it with the HTML template named 'hello', and inserts the generated HTML at the location specified by the JQuery selector '#message'.
FB.api('/me', { fields:'name' }, function(data) {
ctx.exec({ cmd:'html', params:{ data:result, template:'hello', selector:'#message' }});
});
If the 'data' is { name:"John Smith" } and the template 'hello' is "<p>Hello, $(.name)!</p>", this instruction will generate
"\<p\>Hello, John Smith!\</p\>"
and set it as the innerHTML of the DOM element specified by '#message'. It effectively performs
$('#message').html("<p>Hello, John Smith!</p>");
Since this instruction is written in JSON (not in JavaScript), it allows the server to send it to the client and modify the DOM remotely (or even describes the behaviors remotely).
Description of various behaviors in DBI is also possible. For example,
FB.api('/me/friends', function(result) {
ctx.exec([
{ cmd:'html', params:{ template:'friends', selector:'#contents' }}, // (1)
{ cmd:'html', params:{ data:result.data, template:'friend', selector:'#friends', // (2)
bindings:[
{ selector:'.friend', on:'click', actions:[ // (3)
{ cmd:'hide', params: { selector:'#contents' } }, // (4)
{ cmd:'emit', params: { event:'friend_selected', target:'client' } } // (5)
]}
]}
}
]);
});
will fetch the list of Facebook friends of the current user, then perform following actions.
Because of this symmetry (the data binding instruction are portable across server and client) gives maximum flexibility to the developer. It enables three variation of MVC architectures.
FAQs
micro MVC framework for single-page AJAX/html5 apps
The npm package ajmax receives a total of 18 weekly downloads. As such, ajmax popularity was classified as not popular.
We found that ajmax demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.