ForgeTotal.js 5
en

Total.js 5

Declare the route inside the action

Total.js 5 · total5@0.0.19 actionsrouting Executed against Total.js 5

Instead of a separate ROUTE() line, an action can carry its own route in the route option. The action is then the single source of truth for its URL, input and behavior.

definitions/ping.js
NEWACTION('Ping/exec', {
	name: 'Ping',
	route: 'GET /ping/',
	action: function($) {
		$.success('pong');
	}
});