OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 return event.keyCode !== 229 && event.key === 'Enter'; | 805 return event.keyCode !== 229 && event.key === 'Enter'; |
806 } | 806 } |
807 | 807 |
808 /** | 808 /** |
809 * @param {!Event} event | 809 * @param {!Event} event |
810 * @return {boolean} | 810 * @return {boolean} |
811 */ | 811 */ |
812 function isEscKey(event) { | 812 function isEscKey(event) { |
813 return event.keyCode === 27; | 813 return event.keyCode === 27; |
814 } | 814 } |
815 | |
816 /** | |
817 * @param {function()} callback | |
818 * @suppressGlobalPropertiesCheck | |
819 */ | |
820 function runOnWindowLoad(callback) { | |
821 /** | |
822 * @suppressGlobalPropertiesCheck | |
823 */ | |
824 function windowLoaded() { | |
825 window.removeEventListener('DOMContentLoaded', windowLoaded, false); | |
826 callback(); | |
827 } | |
828 | |
829 if (document.readyState === 'complete' || document.readyState === 'interactive
') | |
830 callback(); | |
831 else | |
832 window.addEventListener('DOMContentLoaded', windowLoaded, false); | |
833 } | |
OLD | NEW |