There's really no good reason to use ClientBundle for this, but you
_can_ do it if you want to....
package com.hax.Sample.client.js.inc;
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.TextResource;
import com.google.gwt.resources.client.ClientBundleWithLookup;
public interface SampleAssetsBundle extends ClientBundleWithLookup {
public static final SampleAssetsBundle instance =
GWT.create(SampleAssetsBundle .class);
@Source("myScript.js")
public TextResource myScript();
}
...
package com.hax.Sample.client.js;
public class SampleLoader {
public void injectScript() {
String raw = SampleAssetsBundle.instance.myScript().getText();
ScriptElement e = Document.get().createScriptElement();
e.setText(raw);
Document.get().getBody().appendChild(e);
}
}
...
SampleLoader l = new SampleLoader();
l.injectScript();
~
Doug.
On Feb 11, 7:26 pm, obesga <[email protected]> wrote:
> I want to use a javascript library - just to encode into sha256, this
> is the urlhttp://anmar.eu.org/projects/jssha2/- into GWT code.
>
> I have one way, using JSNI
>
> public final class SHA256 {
>
> public static native String doSHA256(String text) /*-{
> $wnd.doSha256(text);
> }-*/;
>
> }
>
> (I think that's ok )
> as far as the js libraries are included into the host page.
>
> ¿ Is there a way to use a ClientBundle with Javascript libraries /
> files to inject them into GWT code ?
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.