Example #1
0
        private void SendInternal(string httpMethod, string type, JsString url, object data,
            JsAction<object, JsString, jqXHR> success,
            JsAction<JsError, JsString, jqXHR> failed)
        {
            url = addTimeToUrl(url);

            JsObject headers = new JsObject();
            AjaxSettings ajaxSettings = new AjaxSettings
            {
                type = httpMethod,
                dataType = type,
                data = data,
                url = jsUtils.inst.getLocation() + "/" + url,
                headers = headers,
                success = delegate(object o, JsString s, jqXHR arg3) { success(o, s, arg3); },
                error = delegate(jqXHR xhr, JsString s, JsError arg3) { failed(arg3, s, xhr); }
            };
            bool isString = data.As<JsObject>()["toLowerCase"] != null;
            if (isString)
            {
                ajaxSettings.processData = true;
                ajaxSettings.contentType = (type.As<JsString>().toLowerCase() == "xml")
                    ? "application/xml"
                    : "application/json";
            }

            jQuery.ajax(
                ajaxSettings);
        }
Example #2
0
        public void SendGet(string type, JsString url, JsAction<object, JsString, jqXHR> success,
            JsAction<JsError, JsString, jqXHR> failed)
        {
            url = addTimeToUrl(url);

            JsObject headers = new JsObject();
            jQuery.ajax(new AjaxSettings
            {
                type = "GET",
                dataType = type,
                url = jsUtils.inst.getLocation() + "/" + url,
                headers = headers,
                success = delegate(object o, JsString s, jqXHR arg3) { success(o, s, arg3); },
                error = delegate(jqXHR xhr, JsString s, JsError arg3) { failed(arg3, s, xhr); }
            });
        }
Example #3
0
 /// <summary>
 /// Removes an event handler. ...
 /// </summary>
 public object removeListener(JsString eventName, JsAction handler, object scope=null){return null;}
Example #4
0
 /// <summary>
 /// Shorthand for removeManagedListener. ...
 /// </summary>
 public object mun(object item, object ename, JsAction fn, object scope){return null;}
Example #5
0
 /// <summary>
 /// Adds listeners to any Observable object (or Element) which are automatically removed when this Component is
 /// destroyed. ...
 /// </summary>
 public object addManagedListener(object item, object ename, JsAction fn=null, object scope=null, object opt=null){return null;}
Example #6
0
 /// <summary>
 /// The method returns the connection status of the device by invoking a callback function with the status passed.
 /// The status is retrieved by trying to insert an image (tag) into the DOM whose reference URL is a remote stored image
 /// (by default the google logo of google.de is used - we assume that if google is down, you're not connected.
 /// If this is not reliable enough, simply pass your URL as second parameter to the method call).
 /// </summary>
 /// <param name="callback">The callback object defining target and action.
 /// It is also possible to just pass a function to action instead of a string naming the method in a controller.
 /// A constant string (M.ONLINE or M.OFFLINE) is passed to the callback as parameter defining whether the device is online or offline.</param>
 /// <param name="url"> A URL defining a location of an image that is tried to include. If nothing is passed, a default url is used.</param>
 public void getConnectionStatus(JsAction callback, JsString url) { }
Example #7
0
 public void func2(JsAction<string> callback)
 {
 }
Example #8
0
 /// <summary>
 /// Returns the value of a subcookie.
 /// </summary>
 public object getSub(object name, object subName, JsAction converter){return null;}
Example #9
0
        private void requestCanRefund(int day, JsAction complete)
        {
            JsService.Inst.MoneyApi.CanRefund(day, delegate(bool res) {
                ngEntry.canRefund = jsCommonUtils.inst.toBool(res);

                HtmlContext.console.log("request can refund for day = " + day + " response = " + ngEntry.canRefund);
                if (null != complete) {
                    complete();
                }
            });
        }
Example #10
0
 public void requestGetMoney(string userId, JsAction<decimal> complete)
 {
     JsService.Inst.MoneyApi.GetMoney(userId, delegate(decimal res) {
         if (null != complete) {
             complete(res);
         }
     });
 }
Example #11
0
 /// <summary>
 /// Applies the given function to each Node in the NodeList.
 /// </summary>
 public void each(JsAction fn, object context){}
Example #12
0
 /// <summary>
 /// Animate one or more css properties to a given value. Requires the "transition" module.
 /// <pre>example usage:
 /// Y.all('.demo').transition({
 /// duration: 1, // in seconds, default is 0.5
 /// easing: 'ease-out', // default is 'ease'
 /// delay: '1', // delay start for 1 second, default is 0
 /// height: '10px',
 /// width: '10px',
 /// opacity: { // per property
 /// value: 0,
 /// duration: 2,
 /// delay: 2,
 /// easing: 'ease-in'
 /// }
 /// });
 /// </pre>
 /// </summary>
 public void transition(object config, JsAction callback){}
Example #13
0
 /// <summary>
 /// Displays or hides each node.
 /// If the "transition" module is loaded, toggleView optionally
 /// animates the toggling of the nodes using either the default
 /// transition effect ('fadeIn'), or the given named effect.
 /// </summary>
 public void toggleView(object on, JsAction callback){}
Example #14
0
 /// <summary>
 /// Displays or hides each node.
 /// If the "transition" module is loaded, toggleView optionally
 /// animates the toggling of the nodes using either the default
 /// transition effect ('fadeIn'), or the given named effect.
 /// </summary>
 public void toggleView(JsAction callback){}
Example #15
0
 /// <summary>
 /// Executes the function once for each node until a true value is returned.
 /// </summary>
 public object some(JsAction fn, object context){return null;}
Example #16
0
 /// <summary>
 /// Returns the maximum value in the Array. ...
 /// </summary>
 public static object max( object array, JsAction comparisonFn = null ) { return null; }
Example #17
0
	public void requestPermission(JsAction callback) {}
Example #18
0
        private void requestGetUsers(JsAction complete)
        {
            JsService.Inst.UsersApi.GetUsers(delegate(JsArray<ngUserModel> res) {
                JsArray<ngUserModel> tmp = new JsArray<ngUserModel>();
                foreach (ngUserModel user in res) {
                    if (-1 != user.Email.As<JsString>().indexOf("darwins")) {
                        tmp.Add(user);
                    }
                }
                ngUsers = tmp;

                if (null != complete) {
                    complete();
                }
            });
        }
Example #19
0
 public void func1(JsAction callback)
 {
 }
Example #20
0
 /// <summary>
 /// Sorts the elements of an Array. ...
 /// </summary>
 public static JsArray sort( JsArray array, JsAction sortFn = null ) { return null; }
Example #21
0
 public void func2(JsAction<int> callback)
 {
 }
Example #22
0
 /// <summary>
 /// Iterates an array or an iterable value and invoke the given callback function for each item. ...
 /// </summary>
 public static bool each( object iterable, JsAction fn, object scope, bool reverse ) { return false; }
Example #23
0
 /// <summary>
 /// The method returns the connection status of the device by invoking a callback function with the status passed.
 /// The status is retrieved by trying to insert an image (tag) into the DOM whose reference URL is a remote stored image
 /// (by default the google logo of google.de is used - we assume that if google is down, you're not connected.
 /// If this is not reliable enough, simply pass your URL as second parameter to the method call).
 /// </summary>
 /// <param name="callback">The callback object defining target and action.
 /// It is also possible to just pass a function to action instead of a string naming the method in a controller.
 /// A constant string (M.ONLINE or M.OFFLINE) is passed to the callback as parameter defining whether the device is online or offline.</param>
 public void getConnectionStatus(JsAction callback) { }
Example #24
0
 /// <summary>
 /// Iterates an array or an iterable value and invoke the given callback function for each item. ...
 /// </summary>
 public static bool each( object iterable, JsAction fn ) { return false; }
Example #25
0
 /// <summary>
 /// Shorthand for addManagedListener. ...
 /// </summary>
 public object mon(object item, object ename, JsAction fn=null, object scope=null, object opt=null){return null;}
Example #26
0
 /// <summary>
 /// Executes the specified function for each array element until the function returns a falsy value. ...
 /// </summary>
 public static bool every( JsArray array, JsAction fn, object scope ) { return false; }
Example #27
0
 /// <summary>
 /// Shorthand for addListener. ...
 /// </summary>
 public object on(JsString eventName, JsAction handler, object scope=null, object options=null){return null;}
Example #28
0
 /// <summary>
 /// Iterates an array and invoke the given callback function for each item. ...
 /// </summary>
 public static object forEach( JsArray array, JsAction fn, object scope ) { return null; }
Example #29
0
 /// <summary>
 /// Removes listeners that were added by the mon method. ...
 /// </summary>
 public object removeManagedListener(object item, object ename, JsAction fn, object scope){return null;}
Example #30
0
 /// <summary>
 /// Creates a new array with the results of calling a provided function on every element in this array. ...
 /// </summary>
 public static JsArray map( JsArray array, JsAction fn, object scope ) { return null; }