[parenscript-devel] How to use an external JavaScript library (or framework)?

Vladimir Sedach vsedach at gmail.com
Wed Feb 2 22:14:02 UTC 2011


Here's some code that uses jQuery:

(funcall (@ ($ "document") ready)
                 (lambda ()
                   (loop for (tag attribute) in *all-tag-attributes* do
                        (funcall (@ ($ tag) attr)
                                 attribute
                                 (lambda ()
                                   (maybe-rewrite-uri tag
(get-unresolved-uri this attribute)))))))

=>

$('document').ready(function () {
    var _js3 = ALLTAGATTRIBUTES.length;
    var _js2 = 0;
    if (_js2 < _js3) {
        var _js1 = ALLTAGATTRIBUTES[_js2];
        var tag = _js1[0];
        var attribute = _js1[1];
        while (true) {
            $(tag).attr(attribute, function () {
                return maybeRewriteUri(tag, getUnresolvedUri(this, attribute));
            });
            _js2 += 1;
            if (_js2 >= _js3) {
                break;
            };
            _js1 = ALLTAGATTRIBUTES[_js2];
            tag = _js1[0];
            attribute = _js1[1];
        };
    };
    return null;
});

Vladimir

2011/2/2 Nitralime <nitralime at googlemail.com>:
> It would be very nice if you (or somebody else) could provide some code
> snippets.
>
> Nik
>
> PS: Where can I find Fork JavaScript?
>       http://forkjavascript.org/ says "It works!" and that's it.
>
>
> On 02/01/2011 11:57 PM, Vladimir Sedach wrote:
>
> Parenscript lets you use JS object properties and call JS functions
> as-is, and the functions it generates are also callable as-is, so you
> can use any JS library you want without having to do any extra work.
>
> I've used PS with Prototype, jQuery, and Ext JS, but the one library I
> really like is Fork JavaScript.
>
> Vladimir
>
> 2011/2/1 nitralime <nitralime at googlemail.com>:
>
> Hi folks!
>
> I'm almost sure that these questions have been already asked.
> However, I couldn't find any search utility in the archive
> of this mailing list and hence ask them again:
>
> How can an external JavaScript library be used in Parenscript?
> Which JavaScript library does suit Parenscript well?
> What is the idomatic way to integrate a JavaScript library
> into an application using Parenscript?
>
> Any answer (resp. pointer) is very much appreciated.
>
> Regards
> Nik
>
>
>
> _______________________________________________
> parenscript-devel mailing list
> parenscript-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
>
>
>
>




More information about the parenscript-devel mailing list