mirror of
https://github.com/bonfire-networks/bonfire-app.git
synced 2024-05-03 01:38:45 +00:00
22 lines
608 B
JavaScript
Executable file
22 lines
608 B
JavaScript
Executable file
import "./common"
|
|
|
|
let Hooks = {};
|
|
|
|
// TODO: put this in something similar to /config/deps_hooks.js and/or make it extensible/configurable
|
|
import { ImageHooks } from "./../../deps/bonfire_ui_common/assets/js/image"
|
|
|
|
Object.assign(Hooks, ImageHooks);
|
|
|
|
// run LiveView hooks without LiveView
|
|
(function () {
|
|
[...document.querySelectorAll("[phx-hook]")].map((hookEl) => {
|
|
let hookName = hookEl.getAttribute("phx-hook");
|
|
let hook = Hooks[hookName];
|
|
|
|
if (hook) {
|
|
let mountedFn = hook.mounted.bind({ ...hook, el: hookEl });
|
|
mountedFn();
|
|
}
|
|
});
|
|
}) ();
|