Created
December 16, 2014 17:33
-
-
Save JemiloII/9110a25d7cd898ea68a4 to your computer and use it in GitHub Desktop.
Proper way to load Sails.io.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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