mirror of
https://github.com/xzeldon/zeldon-site.git
synced 2025-07-18 14:06:42 +03:00
style: new formatting
This commit is contained in:
21
src/utils.js
21
src/utils.js
@ -1,7 +1,6 @@
|
||||
export let last_update = Date.now();
|
||||
|
||||
export function calc_delta_time()
|
||||
{
|
||||
export function calc_delta_time() {
|
||||
let now = Date.now();
|
||||
let dt = (now - last_update) / 1e3;
|
||||
dt = Math.min(dt, 0.016);
|
||||
@ -9,25 +8,19 @@ export function calc_delta_time()
|
||||
return dt;
|
||||
}
|
||||
|
||||
export function event_listener_array(whos, event_names, callback, options = null)
|
||||
{
|
||||
if (!Array.isArray(whos))
|
||||
{
|
||||
export function event_listener_array(whos, event_names, callback, options = null) {
|
||||
if (!Array.isArray(whos)) {
|
||||
whos = [whos];
|
||||
}
|
||||
for (const name of event_names)
|
||||
{
|
||||
for (const who of whos)
|
||||
{
|
||||
for (const name of event_names) {
|
||||
for (const who of whos) {
|
||||
who.addEventListener(name, callback, options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function import_js_as_module(url)
|
||||
{
|
||||
return new Promise((resole, reject) =>
|
||||
{
|
||||
export async function import_js_as_module(url) {
|
||||
return new Promise((resole, reject) => {
|
||||
const body = document.getElementsByTagName('body')[0];
|
||||
const script = document.createElement('script');
|
||||
script.type = 'module';
|
||||
|
Reference in New Issue
Block a user