in async loader we have:
return window.twttr || (t = {_e: [], ready: function(f) {
t._e.push(f)
}});
which prepares the convenient ‘ready’ function.
use this with oct.js, you will lost ‘ready’ function. because there’s no such ‘_e’ and ‘ready’ initialized for oct.js’s twttr object (unless you can make sure async code finishes first before oct.js).
This is my current solution now:
window.twttr = (function(d, s, id) {
var t, js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id))
return;
js = d.createElement(s);
js.id = id;
js.src = "https://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
// make async loader compatible with oct.js
var _twttr = window.twttr || (t = {_e: [], ready: function(f) {
t._e.push(f)
}});
if (! ('_e' in _twttr)) {
_twttr._e = []
}
if (! ('ready' in _twttr)) {
_twttr.ready = function(f) {
_twttr._e.push(f)
}
}
return _twttr
}(document, "script", "twitter-wjs"));