I have the following (from Tridion PowerTools ) that gets the username from CoreService when some kind of JavaScript is running.
JavaScript (Anguilla):
PowerTools.Popups.Example.prototype._onbtnGetUserInfoClicked = function () { var onSuccess = Function.getDelegate(this, this._handleUserInfo); var onFailure = null; var context = null;
CoreService Side: (C # .svc)
[OperationContract, WebGet(ResponseFormat = WebMessageFormat.Json)] public ExampleData GetUserInfo() { var coreService = Client.GetCoreService(); _exampleData = new ExampleData() { UserName = coreService.GetCurrentUser().Title }; return _exampleData; }
Sends an asynchronous call:
PowerTools.Model.Services.Example.GetUserInfo(onSuccess, onFailure, context, false)
While this assigns another function to handle the response:
Function.getDelegate(this, this._handleUserInfo)
But where does onSuccess, onFailure, context and Boolean: PowerTools.Model.Services.Example.GetUserInfo(onSuccess, onFailure, context, false) ?
This four-parameter signature does not match the no-paramater GetUserInfo () in the utility code. Why is this order and these four?
Alvin reyes
source share