Last active
May 5, 2016 03:46
-
-
Save ashwell/71b7490fe23b938e1ade to your computer and use it in GitHub Desktop.
Revisions
-
ashwell revised this gist
Dec 9, 2015 . 1 changed file with 13 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,22 @@ 'use strict'; var tmpEvent, createEvent, createWithConstructor, createWithInit; createWithConstructor = function( name, descriptor ) { return new CustomEvent( name, descriptor ); }; createWithInit = function( name, descriptor={} ) { var event = document.createEvent( "CustomEvent" ), { bubbles, cancelable, detail } = descriptor; event.initCustomEvent( name, @@ -30,5 +39,5 @@ if ( window ) { } } // ES6 export export default createEvent; -
ashwell revised this gist
Oct 14, 2015 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -19,6 +19,7 @@ createWithInit = function( name, descriptor={} ) { return event; }; // check if supported via try/catch if ( window ) { try { tmpEvent = new CustomEvent( "test" ); @@ -29,5 +30,5 @@ if ( window ) { } } // export export default createEvent; -
ashwell revised this gist
Oct 14, 2015 . 1 changed file with 10 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -6,18 +6,18 @@ createWithConstructor = function( name, descriptor ) { }; createWithInit = function( name, descriptor={} ) { var event = document.createEvent( "CustomEvent" ), { bubbles, cancelable, detail } = descriptor; event.initCustomEvent( name, typeof bubbles === "boolean" ? bubbles : true, typeof cancelable === "boolean" ? cancelable : true, detail || {} ); return event; }; if ( window ) { try { -
ashwell revised this gist
Oct 14, 2015 . 1 changed file with 8 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,11 @@ 'use strict'; var tmpEvent, createEvent, createWithConstructor, createWithInit; createWithConstructor = function( name, descriptor ) { return new CustomEvent( name, descriptor ); }; createWithInit = function( name, descriptor={} ) { var event = document.createEvent( "CustomEvent" ), { bubbles, cancelable, detail } = descriptor; -
ashwell revised this gist
Oct 14, 2015 . No changes.There are no files selected for viewing
-
ashwell created this gist
Oct 14, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ var tmpEvent, createEvent, createWithConstructor = function( name, descriptor ) { return new CustomEvent( name, descriptor ); }, createWithInit = function( name, descriptor={} ) { var event = document.createEvent( "CustomEvent" ), { bubbles, cancelable, detail } = descriptor; event.initCustomEvent( name, typeof bubbles === "boolean" ? bubbles : true, typeof cancelable === "boolean" ? cancelable : true, detail || {} ); return event; }; if ( window ) { try { tmpEvent = new CustomEvent( "test" ); createEvent = createWithConstructor; } catch ( error ) { // use fallback method createEvent = createWithInit; } } // check if supported via try/catch export default createEvent;