Javascript Flow - UNC-Libraries/wilson-clue-app GitHub Wiki
There are 2 javascript files in ./resources/assets/js/. app.js is a constant that contains all the application functions. router.js instantiates these functions based on the current route information which is added as data attributes on the <body> element.
For example:
The DNA route uses the UiController, and the dna method
Route::get('dna', 'UiController@dna')->name('ui.dna');
This adds the following to the <body> element:
<body data-controller="ui" data-action="dna">
Which corresponds to the ui.dna method in router.js, instantiating the initDnaForm method from app.js
ui: {
init: function() {
clue.initSeenAlert();
clue.initUiAlerts();
},
dna: function() {
clue.initDnaForm();
},
The init function is for ALL UiController views.