Skip to content

Instantly share code, notes, and snippets.

@kawasako
Created June 18, 2016 19:34
Show Gist options
  • Save kawasako/ce2ef9eff46772826f6c2b21576082ed to your computer and use it in GitHub Desktop.
Save kawasako/ce2ef9eff46772826f6c2b21576082ed to your computer and use it in GitHub Desktop.
export default class HogeWidget {
constructor(el, resolver) {
this.el = el;
this.resolver = resolver;
}
bind() {
this.el.addEventListener('click', () => { ... });
}
init() {
this.bind();
// 何か非同期な処理
setTimeout(() => {
this.resolver();
}, 1000);
}
}
/*
<div data-widget="hoge">clickable!</hoge>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment