JS hint is giving me a 'SC' is not defined
when using soundcloud SDK
SC.whenStreamingReady( function() {
'SC' is not defined
I'm prepending a variety of js files before my main file - and smashing them together... master has a jQuery closure because this is a WordPress project.
(jQuery is called by default because this is based around a WordPress install)
PREPENDED js files
fastclick (bower)
velocity (bower)
soundcloudSDK (vendor)
(all combined with)
MASTER FILE
master-script.js:
(function($){
// =============================================
"use strict";
$(document).ready(function() {
// get track ready
var topDown = function() {
// soundcloud client ID
var scClientId = 'BLABLABLA';
// initialize the SDK
SC.initialize({
client_id: scClientId,
redirect_uri: "http://example.com/callback.html"
});
SC.whenStreamingReady( function() {
console.log('TOP DOWN');
});
};
});
// =============================================
})(jQuery);
compiled to: compiled-js-file.js
HTML file...
<!doctype html>
<head>
<title>hi</title>
<script src='jQuery.js'></script>
<script src='compiled-js-file.js'></script>
</head>
<body>
<h1>html file</h1>
</body>
</html>
etc.
I've made a .jshintrc file in the base of the theme...
"globals": {
"SC": false
}
and done the ol /* globals: SC: true */
But the .jshinrc doesn't seem to do anything and the comment gets me a
'SC' was used before it was defined.
I'm no JavaScript expert... but I know that SC is an object... but that's also stored in a variable.. so - seems like it should work like a normal variable...
What am I doing wrong? or is this just a thing I have to suffer with? The code is all running as intended... : ) ???
It does not look like you're including a soundcloud api js file, that may be the cause of this issue.