Skip to content

Instantly share code, notes, and snippets.

@oott123

oott123/test.js Secret

Created March 19, 2017 05:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oott123/a1001fdfd0d33d8711f5b7aa12f666fe to your computer and use it in GitHub Desktop.
Save oott123/a1001fdfd0d33d8711f5b7aa12f666fe to your computer and use it in GitHub Desktop.
// login.js
let loading = new Promise((resolve, reject) => {
$.get('http://example.com/login', (data) => {
if (data.login) resolve()
})
})
// in other files
loading.then(() => {
// your logic after login
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment