Created
June 29, 2015 14:08
-
-
Save styks1987/b13adf5716b36f4c6ac7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
events.fireEvent = function(obj, type, data) { | |
var e = document.createEvent('UIEvents'), | |
cur, | |
val; | |
// TODO: Test cancelling | |
e.initEvent(type, false, true); | |
// Copy provided data into event object | |
if (data) { | |
for (cur in data) { | |
e[cur] = data[cur]; | |
} | |
} | |
return obj.dispatchEvent(e); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment