jquery - Detect javascript finish to show/hide loading icon -


i using canvas draw chart :

var lg = new html5.graph.line //(just sample) lg.draw(itemsredraw, colorredraw, line, param); 

this line take 6s, i want show loading icon , when above line finish, loading icon hide().

i can not find how detect if line finish.

any or way appreciate.

thanks help.

aren't draw functions synchronous? should able call whatever want on line right after draw(blah) , executed right after draw completed. if want abstract somewhat, can add parameter in html5.graph.line.draw function called "callback" , execute callback right after draw command.

html5.graph.line.draw = function (itemsredrae, colorredraw, line, param, callback) {     //draw line     if (typeof (callback) == 'function') {         callback();     } }; 

then when want use draw function, include callback.

//show loading overlay lg.draw(true, true, line, param, function () {     //hide loading overlay     console.log('done!'); }); 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -