Calling window.open through port

心已入冬 提交于 2019-12-06 11:13:26

It's not super pretty, but you can do something like

a 
    [ Html.Attributes.attribute "onClick" "window.open(this.href, this.target, 'width=800,height=600'); return false;" ]
    [ text "Click me" ]

It's an underhanded way to handle this, and not 100% strictly guaranteed to continue working in future elm releases but I've done this more than once in a pinch:

https://medium.com/@prozacchiwawa/the-i-m-stupid-elm-language-nugget-7-8d3efd525e3e

A property getter on the DOM node type can be triggered by a json decoder during event handling. You can run whatever code you want as a side effect of accessing it. The object being accessed by the json decoder is the real event object on the event handler stack as things are now.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!