Fix javascript debugger; from Script Sharp

I want to fix only the debugger; to javascript from c # script sharp code. I understand that I can write Script.Literal ("debugger") . I would prefer not to use Script.Literal if it is absolutely necessary. I would rather write something like Debugger.Break (); in C #, when the emitted javascript is just a debugger; Is there any attribute that will allow me to do this if I create an imported library?

+3
source share
2 answers

This is pretty hack, but it works. You need to be creative when what you want to do is not officially supported, right?

Script.Alert [ScriptAlias] JavaScript. , ScriptAliasAttribute .

namespace MyNamespace
{

    [GlobalMethods]
    [IgnoreNamespace]
    [Imported]
    public static class Debugger
    {
        [ScriptAlias("debugger;//")]//must comment out ();
        public static void Break()
        {
            //this outputs -  debugger;//();
        }
    }
}

, , Debugger.Break(); #, debugger;//(); JavaScript. , .

+3

Debug.Fail... #.

0

All Articles