Search results

  1. edwardsmarkf

    JavaScript a couple of js debounce questions

    this is very pecular, but somehow the event is being switched to the parent element. so instead i am doing this: element.addEventListener('keyup', (event) => { processChange(event.currentTarget, event.target)); // notice event has been added function debounce(func, timeout = 300){...
  2. edwardsmarkf

    JavaScript a couple of js debounce questions

    hello all - having studied these two excellent examples: https://dillionmegida.com/p/debouncing-in-javascript/ https://www.freecodecamp.org/news/javascript-debounce-example/ surprisingly neither of them included how to pass the event information to the debounced script. here is what i...
  3. edwardsmarkf

    JavaScript using "import from" dynamically

    i figured it out: var WaveSurfer = null; let script = document.createElement('script') ; script.type = 'module' ; script.innerText = "import ws from 'https://unpkg.com/wavesurfer.js@beta'; WaveSurfer=ws;"; document.head.appendChild(script); the solution is...
  4. edwardsmarkf

    JavaScript using "import from" dynamically

    Edit - adding this: script.innerText = "import myName from '/js/myJavaScript'"; gets me an identical value in: document.getElementsByTagName('script')[0] as the import myName from does, but sadly still does not work. console.log(document.getElementsByTagName('script')[0] ) ; //...
  5. edwardsmarkf

    JavaScript using "import from" dynamically

    hello - i have used the following syntax a number of times with much success: let script = document.createElement('script') ; script.src = '/js/myJavaScript.js' ; script.type = 'text/javascript' ...
  6. edwardsmarkf

    JavaScript promises changing question

    i received some excellent feedback from sitepoint: https://www.sitepoint.com/community/t/promises-feedback/384246/ const firstPromise = (promiseInput) => { return new Promise( (resolve, reject) => { console.log(promiseInput); let returnStuff = promiseInput + ' -...
  7. edwardsmarkf

    JavaScript promises changing question

    hello all, first time on this forum. i have serious problems trying to wrap my head around promises, so i have decided to just keep a couple of working examples around so i can refer back to those. here is an example i was able to put together: const firstPromise = (promiseInput) => {...
Top Bottom