Invoke a client js function in Meteor after getting results from the server

前端 未结 4 2145
猫巷女王i
猫巷女王i 2020-12-14 13:27

I\'m trying to see how can I invoke a js function after the client gets a result from a Meteor method call. The only thing I was able to get is to invoke the function

4条回答
  •  旧巷少年郎
    2020-12-14 14:06

    I simple approach to call a JavaScript client-side function would be to add a script tag in your html template that is bound by your collection. Anytime a new item is inserted, this tag would be inserted into the client would run your function. I have a collection call uploads with some properties such as name. The following template triggers drawpoints() client-side function upon receipt of a new item in Uploads collection:

        {{#each uploads}}
            
                {{name}}
                
                    
                
            
            
        {{/each}}
    

提交回复
热议问题