Pass data to callback when asynchronously loading google maps V3

前端 未结 2 1612
不知归路
不知归路 2021-02-13 22:33

I am loading the google maps API asynchronously which allows you to define a callback to execute when the API loads. Is there any way I can pass arguments to the callback?

2条回答
  •  不要未来只要你来
    2021-02-13 23:10

    How about wrapping your function into some dummy function that passes necessary arguments like:

    function wrapper()
    {
        myCallback(arg1, arg2);
    }
    

    and pass wrapper() as a google maps callback

提交回复
热议问题