Skip to content

Instantly share code, notes, and snippets.

@JemiloII
Created December 16, 2014 17:33
Show Gist options
  • Save JemiloII/9110a25d7cd898ea68a4 to your computer and use it in GitHub Desktop.
Save JemiloII/9110a25d7cd898ea68a4 to your computer and use it in GitHub Desktop.
Proper way to load Sails.io.js
<script>
(function onLoad() {
var io;
Object.defineProperty(window, 'io', {
get: function get() {
return io;
},
set: function set(value) {
var sails;
io = value;
Object.defineProperty(io, 'sails', {
get: function get() {
return sails;
},
set: function set(value) {
sails = value;
sails.url = '@@backendUrl';
}
});
}
});
})();
</script>
<script src="sails.io.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment