Creating custom DOM events with scalajs

前端 未结 2 1404
天涯浪人
天涯浪人 2021-01-22 18:23

I can\'t find a way to create custom events with scala-js. For instance, with js you can create a custom event like the following (taken from here):

  var event          


        
2条回答
  •  礼貌的吻别
    2021-01-22 18:44

    If you want to stay in the typed DOM (assuming you are talking about the scala-js-dom library), you can do:

    new CustomEvent().initCustomEvent('build', false, false, elem.dataset.time)
    

    The constructor you are using is actually only specified in DOM 4 (see MDN).

提交回复
热议问题