if have javascript:

```
function calculateValues(callback)
        {

            window.external.getHistoryRange(0,1,"",function(res){
                var hist = eval(res);
                histCount = hist.historyCount;
                hist = hist.historyContent;
                if (histCount == 0)
                {
                    return;
                }
                $("#history_table").show();
                var $row = addAlertHistoryRow(hist[0]);
                var rowHeight = $row.height();
                pageItemsCount = Math.floor(contentHeight / rowHeight);
                curPageNum = 0;
                $row.remove();

                if (callback) callback();
            });

        }

```

in function calculateValues(callback) callback parameter is:

```
function(){statItempos = 0; gethistoryandshow(pageNum,startItemsPos,callback);}

```

and c# code, that works with that script (ObjectForScripting):

```
public string getHistoryRange(string strVar0 = "", string strVar1 = "", string strVar2 = "", string strVar3 = "")
        {
            string res = "";
            using (DeskAlertsDbContext db = new DeskAlertsDbContext())
            {

                var alerts = db.HistoryAlerts.OrderBy(a => a.ReciveTime)
                    .Include(b => b.alert.WINDOW)
                    .ToList();
                foreach (var alert in alerts)
                {

                    res += ("{\"id\":" + System.Web.HttpUtility.JavaScriptStringEncode(alert.alert.Alert_id) +
                            ",\"date\":\"" +
                            System.Web.HttpUtility.JavaScriptStringEncode(
                                alert.ReciveTime.ToString(CultureInfo.InvariantCulture)) + "\",\"alert\":\"" +
                            System.Web.HttpUtility.JavaScriptStringEncode(alert.alerttext) + "\",\"title\":\"" +
                            System.Web.HttpUtility.JavaScriptStringEncode(alert.alert.Title) + "\",\"acknow\":\"" +
                            System.Web.HttpUtility.JavaScriptStringEncode(alert.alert.Acknown) + "\",\"create\":\"" +
                            System.Web.HttpUtility.JavaScriptStringEncode(alert.alert.Create_date) + "\",\"class\":\"" +
                            "1" + "\",\"urgent\":\"" + System.Web.HttpUtility.JavaScriptStringEncode(alert.alert.Urgent) +
                            "\",\"unread\":\"" + Convert.ToInt32(alert.isclosed).ToString() + "\",\"position\":\"" +
                            System.Web.HttpUtility.JavaScriptStringEncode(alert.alert.Position) + "\",\"ticker\":\"" +
                            alert.alert.Ticker + "\",\"to_date\":\"" +
                            System.Web.HttpUtility.JavaScriptStringEncode(alert.alert.To_date) + "\"},");
                }

                res = res.TrimEnd(','); //trim right ","
                res = "({\"historyCount\":" + alerts.Count.ToString() + ",\"historyContent\":[" + res + "]});";

                Browserwindow.Wb.InvokeScript("eval", new object[] { strVar3 });
                Browserwindow.Wb.InvokeScript("CallbackFunction", new object[] { res });

                return res;
            }

        }

```

On string: "`Browserwindow.Wb.InvokeScript("eval", new object[] { strVar3 });`"
I try to call anonymous function from javascript and have an error. 

Question is: how to make this logic. How to perform the JS function of the parameters a different function. And then continue JS. If i tryed to give name to function, and invoke it, function works, but global context(`if (callback) callback();`) becomes unavailible