Skip to content

Author: admin@master

JS Promises: Fulfill vs Resolve

I understand Promises to exist in one of three states: A Promise can either be pending (unresolved), fulfilled (resolved successfully) or rejected (resolved unsuccessfully). Reading through the A+ Promise Spec and MDN’s documentation, I am confused that they both acknowledge the fulfilled and rejected s…

Detect sound is ended in THREE.PositionalAudio?

I want to detect when sounds is ending, but all examples that i found not working. Live example: http://codepen.io/anon/pen/wMRoWQ Answer Three.Audio is wrapper around a buffer source audio object. https://github.com/mrdoob/three.js/blob/ddab1fda4fd1e21babf65aa454fc0fe15bfabc33/src/audio/Audio.js#L12 It looks…

Deselect all selected rows in DataTables

I’m using jQuery Datatables plugin (v 1.10) I am using the select feature and can highlight/select rows fine. I’m also using paging. I can page through the tables and select on multiple pages. I tried to create a button to clear selected rows, but it only clears rows selected on the current page. …

Retrieve naturalWidth of updated image src

I am using jQuery in Rails4 to update the src attribute of an image. I am also using paperclip for image uploading. The flow: when I click the image in the first time, it returns the thumb width(140px). However, the subsequent clicks return the natural width of the original image(1200px). Is it possible to ge…