javascript - 'Audio' was used before it was defined -


i have javascript file i'm checking jslint (notepad++ plugin v0.8.2). have following options set:

/*jslint indent: 4, maxerr: 9999, white: true, browser: true, devel: true, es5: true, plusplus: true, regexp: true, sloppy: true */ 

jslint complaining on line:

new audio('sounds/ding.wav').play(); 

'audio' used before defined

seems doesn't es5? how can make error go away?

you should able list audio "predefined" in plugin's options or, mentioned, as global within file that's using it:

/*global audio: false */ 

including false here describes read-only.

the error because jslint doesn't acknowledge it possible global browsers:

// browser contains set of global names commonly provided // web browser environment.          browser = array_to_object([             'clearinterval', 'cleartimeout', 'document', 'event', 'formdata',             'frames', 'history', 'image', 'localstorage', 'location', 'name',             'navigator', 'option', 'parent', 'screen', 'sessionstorage',             'setinterval', 'settimeout', 'storage', 'window', 'xmlhttprequest'         ], false), 

also, note audio defined html rather ecmascript.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -