Skip to content

Instantly share code, notes, and snippets.

@st98
Last active August 29, 2015 14:22
Show Gist options
  • Save st98/f6094dfc8102184beba8 to your computer and use it in GitHub Desktop.
Save st98/f6094dfc8102184beba8 to your computer and use it in GitHub Desktop.
DOMContentLoaded
import time
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return '''
<!doctype html>
<body>
<head>
<title>DOMContentLoaded</title>
</head>
<body>
<h1>DOMContentLoaded</h1>
<img src="a.png">
<script>
window.addEventListener('load', function () { console.log('<load>'); });
window.addEventListener('DOMContentLoaded', function () { console.log('<DOMContentLoaded>'); });
</script>
</body>
</body>
'''
@app.route('/a.png')
def a():
time.sleep(5)
return ''
if __name__ == '__main__':
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment