Skip to content

Methods

zodern edited this page Nov 4, 2014 · 2 revisions

#Methods

Methods try to duplicate the functionality of meteor.methods.

#Limitations When calling a method, it is currently only possible to send one argument. If you want to send multiple values, use an object.

Don't use any asynchronous calls in the server methods otherwise the method will return before it is done.

#Use

##Create method (server)

methods is a global variable. Use methods.add to add methods.

methods.add({
    methodName : function(data){
        // do something
    },

    methodName2 : someFunction
})

##Call Method (client) methods is a global variable. Use methods.call to call a method.

method.call(methodName, data, callBack())

Example

method.call("methodName", {data: "some data"}, function(error, result){

    // do something

})

Home

Contributing to Silk

Building Apps

Using Silk

Clone this wiki locally