-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea270f0
commit ee8fb10
Showing
2 changed files
with
34 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,34 @@ | ||
module.exports = require('./components/all.js') | ||
import Autocomplete from './components/autocomplete/autocomplete.js' | ||
import Edge from './components/edge/edge.js' | ||
import WarnOnUnsavedChanges from './components/warn-on-unsaved-changes/warn-on-unsaved-changes.js' | ||
|
||
function initAll (options) { | ||
// Set the options to an empty object by default if no options are passed. | ||
options = typeof options !== 'undefined' ? options : {} | ||
|
||
// Allow user to initialise components in only certain sections of the page | ||
// Defaults to the entire document if nothing is set. | ||
const scope = typeof options.scope !== 'undefined' ? options.scope : document | ||
|
||
const $autocompletes = scope.querySelectorAll('[data-module="autocomplete"]') | ||
$autocompletes.forEach(function ($autocomplete) { | ||
new Autocomplete($autocomplete).init() | ||
}) | ||
|
||
const $edges = scope.querySelectorAll('[data-module="edge"]') | ||
$edges.forEach(function ($edge) { | ||
new Edge($edge).init() | ||
}) | ||
|
||
const $forms = scope.querySelectorAll('[data-module="warn-on-unsaved-changes"]') | ||
$forms.forEach(function ($form) { | ||
new WarnOnUnsavedChanges($form).init() | ||
}) | ||
} | ||
|
||
export { | ||
initAll, | ||
Autocomplete, | ||
Edge, | ||
WarnOnUnsavedChanges | ||
} |
This file was deleted.
Oops, something went wrong.