Better HN
topnewbestaskshowjobs
Log inSign up

s_m_mcguire

15 karma · joined Feb 10, 2017 (9y ago) · 4 submissions

https://twitter.com/s_m_mcguire https://github.com/steveorsomethin
Submissions

comment 9y ago · link · parent

Accounting for your average person, who do you estimate is more likely to cancel: The person watching hundreds of hours of meaningless action movies and TV, or the person subscribing but rarely/never watching anything? By average I mean not prone to suddenly realizing they want/feel sufficiently motivated to spend those hundreds of hours on something else, or posting on hacker news.

Speaking anecdotally, the one (temporary) time I canceled was when I found myself in the paying-but-not-using category.

comment 9y ago · link · parent

In my case I knew when the owning Rust struct was destroyed, and it was guaranteed to be the only thing holding the element handle so I would just free the DOM node during the destruction logic.

For something more general purpose I'd probably just use a destructor (whether C++ or Rust) with the same guarantee of single-ownership of the underlying ID, and the DOM node will automatically be freed once the native handle goes out of scope.

Edit: Of course, you'd have to prohibit copies on the native side.

comment 9y ago · link · parent

Not first class access, but you can call arbitrary JavaScript via FFI. An approach that worked fine for me was to use a simple object which holds your DOM handles via incrementing numeric IDs and pass them back to your Rust (or C++) code. I found the FFI overhead to be non-existent compared to the actual DOM work as well.