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>
 /// Shorthand for removeManagedListener. ...
 /// </summary>
 public object mun(object item, object ename, JsAction fn, object scope){return null;}
Example #4
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 #5
0
 /// <summary>
 /// Returns the value of a subcookie.
 /// </summary>
 public object getSub(object name, object subName, JsAction converter){return null;}
Example #6
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 #7
0
 /// <summary>
 /// Sorts the elements of an Array. ...
 /// </summary>
 public static JsArray sort( JsArray array, JsAction sortFn = null ) { return null; }
Example #8
0
 /// <summary>
 /// Applies the given function to each Node in the NodeList.
 /// </summary>
 public void each(JsAction fn, object context){}
Example #9
0
 /// <summary>
 /// Listens for the "on" moment of events fired by the host,
 /// or injects code "before" a given method on the host.
 /// </summary>
 public EventHandle doBefore(object strMethod, JsAction fn, object context)
 {
     return(null);
 }
Example #10
0
 /// <summary>
 /// Injects a function to be executed before a given method on host object.
 /// The function will be detached when the plugin is unplugged.
 /// </summary>
 public EventHandle beforeHostMethod(object method, JsAction fn, object context)
 {
     return(null);
 }
Example #11
0
 public JsNumber subscribe(JsAction <ValidationErrorsChangedEventArgs> callback = null)
 {
     return(null);
 }
Example #12
0
 public JsNumber subscribe(JsAction <PropertyChangedEventArgs> callback = null)
 {
     return(null);
 }
Example #13
0
 public Promise loadNavigationProperty(NavigationProperty navigationProperty, JsAction callback = null, JsAction errorCallback = null)
 {
     return(null);
 }
Example #14
0
 public JsNumber subscribe(JsAction <object> callback = null)
 {
     return(null);
 }
Example #15
0
 public Promise then(JsAction callback)
 {
     return(null);
 }
Example #16
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 #17
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 #18
0
 /// <summary>
 /// Listens for the "on" moment of events fired by the host object.
 /// Listeners attached through this method will be detached when the plugin is unplugged.
 /// </summary>
 public EventHandle onHostEvent(object type, JsAction fn, object context)
 {
     return(null);
 }
Example #19
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 #20
0
 /// <summary>
 /// Adds a listener to be notified when the browser window is resized and provides resize event buffering (100 millisecon...
 /// </summary>
 public static object onWindowResize(JsAction fn, object scope, bool options)
 {
     return(null);
 }
Example #21
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 #22
0
 /// <summary>
 /// Removes an event handler from an element. ...
 /// </summary>
 public static object removeListener(object el, JsString eventName, JsAction fn, object scope)
 {
     return(null);
 }
Example #23
0
 /// <summary>
 /// Returns the maximum value in the Array. ...
 /// </summary>
 public static object max( object array, JsAction comparisonFn = null ) { return null; }
Example #24
0
 /// <summary>
 /// Removes the passed window resize listener. ...
 /// </summary>
 public static object removeResizeListener(JsAction fn, object scope)
 {
     return(null);
 }
Example #25
0
 public void func2(JsAction<string> callback)
 {
 }
Example #26
0
 /// <summary>
 /// Removes the passed window unload listener. ...
 /// </summary>
 public static object removeUnloadListener(JsAction fn, object scope)
 {
     return(null);
 }
Example #27
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 #28
0
 /// <summary>
 /// Adds a listener to be notified when the document is ready (before onload and before images are loaded). ...
 /// </summary>
 public static object onDocumentReady(JsAction fn, object scope = null, bool options = false)
 {
     return(null);
 }
Example #29
0
 /// <summary>
 /// Removes an event handler. ...
 /// </summary>
 public object removeListener(JsString eventName, JsAction handler, object scope=null){return null;}
Example #30
0
        //TODO: ServerOptions:  The options is similar to tls.createServer().

        /// <summary>
        /// Makes a request to a secure web server.
        /// </summary>
        /// <param name="options">options can be an object or a string. If options is a string, it is automatically parsed with url.parse().
        /// All options from http.request() are valid.</param>
        /// <param name="callback"></param>
        /// <returns></returns>
        /// <example>
        /// Example:
        /// <code>
        /// var https = require('https');
        ///
        ///var options = {
        ///  hostname: 'encrypted.google.com',
        ///  port: 443,
        ///  path: '/',
        ///  method: 'GET'
        ///};
        ///
        ///var req = https.request(options, function(res) {
        ///  console.log("statusCode: ", res.statusCode);
        ///  console.log("headers: ", res.headers);
        ///
        ///  res.on('data', function(d) {
        ///    process.stdout.write(d);
        ///  });
        ///});
        ///req.end();
        ///
        ///req.on('error', function(e) {
        ///  console.error(e);
        ///});
        /// </code>
        /// </example>
        /// The options argument has the following options:
        /// <list type = "bullet">
        ///host: A domain name or IP address of the server to issue the request to. Defaults to 'localhost'.
        ///hostname: To support url.parse() hostname is preferred over host
        ///port: Port of remote server. Defaults to 443.
        ///method: A string specifying the HTTP request method. Defaults to 'GET'.
        ///path: Request path. Defaults to '/'. Should include query string if any. E.G. '/index.html?page=12'
        ///headers: An object containing request headers.
        ///auth: Basic authentication i.e. 'user:password' to compute an Authorization header.
        ///agent: Controls Agent behavior. When an Agent is used request will default to Connection: keep-alive. Possible values:
        ///undefined (default): use globalAgent for this host and port.
        ///Agent object: explicitly use the passed in Agent.
        ///false: opts out of connection pooling with an Agent, defaults request to Connection: close.
        /// </list>
        ///The following options from tls.connect() can also be specified. However, a globalAgent silently ignores these.
        ///<list type = "bullet">
        ///pfx: Certificate, Private key and CA certificates to use for SSL. Default null.
        ///key: Private key to use for SSL. Default null.
        ///passphrase: A string of passphrase for the private key or pfx. Default null.
        ///cert: Public x509 certificate to use. Default null.
        ///ca: An authority certificate or array of authority certificates to check the remote host against.
        ///ciphers: A string describing the ciphers to use or exclude. Consult http:///www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT for details on the format.
        ///rejectUnauthorized: If true, the server certificate is verified against the list of supplied CAs. An 'error' event is emitted if verification fails. Verification happens at the connection level, before the HTTP request is sent. Default false.
        ///</list>
        ///In order to specify these options, use a custom Agent.
        /// <example>
        ///Example:
        /// <code>
        ///var options = {
        ///  hostname: 'encrypted.google.com',
        ///  port: 443,
        ///  path: '/',
        ///  method: 'GET',
        ///  key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
        ///  cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
        ///};
        ///options.agent = new https.Agent(options);
        ///
        ///var req = https.request(options, function(res) {
        ///  ...
        ///}
        ///</code>
        ///</example>
        ///Or does not use an Agent.
        ///<example>
        ///Example:
        /// <code>
        ///var options = {
        ///  hostname: 'encrypted.google.com',
        ///  port: 443,
        ///  path: '/',
        ///  method: 'GET',
        ///  key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
        ///  cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
        ///  agent: false
        ///};
        ///
        ///var req = https.request(options, function(res) {
        ///  ...
        ///}
        ///</code>
        ///</example>
        public object request(RequestOptions options, JsAction callback)
        {
            return(null);
        }
Example #31
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 #32
0
        //TODO: can also use tls.connect() options

        /// <summary>
        /// Like http.get() but for HTTPS.
        /// </summary>
        /// <param name="options">options can be an object or a string. If options is a string, it is automatically parsed with url.parse(). </param>
        /// <param name="callback"></param>
        /// <returns></returns>
        /// <example>
        /// Example:
        /// <code>
        /// var https = require('https');
        ///
        /// https.get('https://encrypted.google.com/', function(res) {
        ///   console.log("statusCode: ", res.statusCode);
        ///   console.log("headers: ", res.headers);
        ///
        ///   res.on('data', function(d) {
        ///     process.stdout.write(d);
        ///   });
        ///
        /// }).on('error', function(e) {
        ///   console.error(e);
        /// });
        /// </code>
        /// </example>
        public object get(JsString options, JsAction callback)
        {
            return(null);
        }
Example #33
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 #34
0
 /// <summary>
 /// Like http.get() but for HTTPS.
 /// </summary>
 /// <param name="options">options can be an object or a string. If options is a string, it is automatically parsed with url.parse(). </param>
 /// <param name="callback"></param>
 /// <returns></returns>
 /// <example>
 /// Example:
 /// <code>
 /// var https = require('https');
 ///
 /// https.get('https://encrypted.google.com/', function(res) {
 ///   console.log("statusCode: ", res.statusCode);
 ///   console.log("headers: ", res.headers);
 ///
 ///   res.on('data', function(d) {
 ///     process.stdout.write(d);
 ///   });
 ///
 /// }).on('error', function(e) {
 ///   console.error(e);
 /// });
 /// </code>
 /// </example>
 public object get(object options, JsAction callback)
 {
     return(null);
 }
Example #35
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 #36
0
        /// <summary>
        /// Returns a new HTTPS web server object. The options is similar to tls.createServer(). The requestListener is a function which is automatically added to the 'request' event.
        /// <example>
        /// Example:
        ///<code>
        /// // curl -k https://localhost:8000/
        /// var https = require('https');
        /// var fs = require('fs');

        /// var options = {
        ///  key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
        ///  cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
        /// };

        /// https.createServer(options, function (req, res) {
        ///   res.writeHead(200);
        ///   res.end("hello world\n");
        /// }).listen(8000);
        /// </code>
        /// </example>
        /// <example>
        /// Or
        ///<code>
        /// var https = require('https');
        /// var fs = require('fs');
        ///
        /// var options = {
        ///  pfx: fs.readFileSync('server.pfx')
        /// };
        ///
        /// https.createServer(options, function (req, res) {
        ///   res.writeHead(200);
        ///   res.end("hello world\n");
        /// }).listen(8000);
        /// </code>
        /// </example>
        /// </summary>
        /// </summary>
        /// <param name="options"> The options is similar to tls.createServer(). </param>
        /// <param name="requestListener">The requestListener is a function which is automatically added to the 'request' event.</param>
        /// <returns>Returns a new HTTPS web server object.</returns>
        public object createServer(object options, JsAction requestListener)
        {
            return(null);
        }
Example #37
0
 public void requestGetMoney(string userId, JsAction<decimal> complete)
 {
     JsService.Inst.MoneyApi.GetMoney(userId, delegate(decimal res) {
         if (null != complete) {
             complete(res);
         }
     });
 }
Example #38
0
 public int SetTimeout(JsAction handler, int timeout)
 {
     return(default(int));
 }
Example #39
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 #40
0
 public int SetInterval(JsAction handler, int timeout)
 {
     return(default(int));
 }
Example #41
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 #42
0
 /// <summary>
 /// Expand a record that is loaded in the view. ...
 /// </summary>
 public object expand(Ext.data.Model record, bool deep = false, JsAction callback = null, object scope = null)
 {
     return(null);
 }
Example #43
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 #44
0
 /// <summary>
 /// Sets which view is active/visible for the application. This will set the
 /// app's `activeView` attribute to the specified `view`.
 /// When a string-name is provided for a view which has been registered on this
 /// app's `views` object, the referenced metadata will be used and the
 /// `activeView` will be set to either a preserved view instance, or a new
 /// instance of the registered view will be created using the specified `config`
 /// object passed-into this method.
 /// A callback function can be specified as either the third or fourth argument,
 /// and this function will be called after the new `view` becomes the
 /// `activeView`, is rendered to the `viewContainer`, and is ready to use.
 /// </summary>
 public void showView(object view, JsAction callback)
 {
 }
Example #45
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; }
Example #46
0
 /// <summary>
 /// Sets which view is active/visible for the application. This will set the
 /// app's `activeView` attribute to the specified `view`.
 /// When a string-name is provided for a view which has been registered on this
 /// app's `views` object, the referenced metadata will be used and the
 /// `activeView` will be set to either a preserved view instance, or a new
 /// instance of the registered view will be created using the specified `config`
 /// object passed-into this method.
 /// A callback function can be specified as either the third or fourth argument,
 /// and this function will be called after the new `view` becomes the
 /// `activeView`, is rendered to the `viewContainer`, and is ready to use.
 /// </summary>
 public void showView(object view, object config, object options, JsAction callback)
 {
 }
Example #47
0
	public void requestPermission(JsAction callback) {}
Example #48
0
 /// <summary>
 /// Cascades down the component/container heirarchy from this component (passed in the first call), calling the specified...
 /// </summary>
 public Ext.container.Container cascade(JsAction fn, object scope = null, JsArray args = null)
 {
     return(null);
 }
Example #49
0
 public void func1(JsAction callback)
 {
 }
Example #50
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 #51
0
 public void func2(JsAction<int> callback)
 {
 }
Example #52
0
 /// <summary>
 /// Shorthand for removeManagedListener. ...
 /// </summary>
 public object mun(object item, object ename, JsAction fn, object scope)
 {
     return(null);
 }
Example #53
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 #54
0
 /// <summary>
 /// Removes an event handler. ...
 /// </summary>
 public object removeListener(JsString eventName, JsAction handler, object scope = null)
 {
     return(null);
 }
Example #55
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 #56
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 #57
0
 /// <summary>
 /// Shorthand for addListener. ...
 /// </summary>
 public object on(JsString eventName, JsAction handler, object scope=null, object options=null){return null;}
Example #58
0
 /// <summary>
 /// Shorthand for removeListener. ...
 /// </summary>
 public object un(JsString eventName, JsAction handler, object scope = null)
 {
     return(null);
 }
Example #59
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 #60
0
 /// <summary>
 /// Appends an event handler to this object. ...
 /// </summary>
 public object addListener(JsString eventName, JsAction handler, object scope = null, object options = null)
 {
     return(null);
 }