problems invoking a function from an external javascript source file...

6 views
Skip to first unread message

Komal

unread,
Dec 4, 2009, 5:45:15 AM12/4/09
to Google Web Toolkit
Hi,

I am trying to invoke a method from prettify.js the method looks like
this....
my jsni method:-


public native String getPrettifiedOutput(String result)
/*-{
var prettyPrintingJob = {
sourceCodeHtml: result,
langExtension: '.java',
};
$wnd.applyDecorator(prettyPrintingJob);
return prettyPrintingJob.prettyPrintedHtml;
}-*/;

///---------------------------------------------------------------------------

method definition in the js file is :-
http://code.google.com/p/google-code-prettify/source/browse/trunk/src/prettify.js#1382


function applyDecorator(job) {
var sourceCodeHtml = job.sourceCodeHtml;
var opt_langExtension = job.langExtension;

// Prepopulate output in case processing fails with an exception.
job.prettyPrintedHtml = sourceCodeHtml;

try {
// Extract tags, and convert the source code to plain text.
var sourceAndExtractedTags = extractTags(sourceCodeHtml);
/** Plain text. @type {string} */
var source = sourceAndExtractedTags.source;
job.source = source;
job.basePos = 0;

///---------------------------------------------------------------------------

Am I invoking the method properly?
Please let me know for the changes I need to make.....

Thanks,
Komal




Thomas Broyer

unread,
Dec 4, 2009, 5:56:58 AM12/4/09
to Google Web Toolkit

On 4 déc, 11:45, Komal <ko...@ensarm.com> wrote:
> Hi,
>
> I am trying to invoke a method from prettify.js the method looks like
> this....
> my jsni method:-
>
>         public native String getPrettifiedOutput(String result)
>         /*-{
>                  var prettyPrintingJob = {
>               sourceCodeHtml: result,
>               langExtension: '.java',
>             };
>             $wnd.applyDecorator(prettyPrintingJob);

applyDecorator is "private" in prettify.js, only
PR_SHOULD_USE_CONTINUATION, PR_normalizedHtml, prettyPrintOne,
prettyPrint and PR are public (well, and _pr_isIE6 too, but it's kind
of an "implementation detail")
Reply all
Reply to author
Forward
0 new messages