////////////////////////////////////////////////////////////////////////////////
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
package
{
/**
* @externs
*/
COMPILE::JS
public class StimulsoftReports
{
/**
* <inject_script>
* var script = document.createElement("script");
* script.setAttribute("src",
"resources/stimulsoftreports/stimulsoft.reports.js");
* document.head.appendChild(script);
* window.onload = function()
* {
* var script = document.createElement("script");
* script.setAttribute("src",
"resources/stimulsoftreports/stimulsoft.viewer.js");
* document.head.appendChild(script);
* }
* var link = document.createElement("link");
* link.setAttribute("rel", "stylesheet");
* link.setAttribute("href",
"resources/stimulsoftreports/stimulsoft.viewer.office2013.whiteblue.css");
* document.head.appendChild(link);
* </inject_script>
*/
public function StimulsoftReports(){}

public static function loadReport(renderArea:Element,
reportDefinition:String):void {}
}
}

Notice in the example the second library stimulsoft.viewer.js
This second library depends on the first one so I add this library after
load.

I don't know if there is a better way or this workaround it's in fact the
only way.

Another approach maybe is to have a JS that loads this 2 libraries and
inject this only JS file (I didn't test this theorical approach).

Carlos Rovira <[email protected]> escreveu no dia sexta, 2/10/2020
à(s) 12:15:

> Hi Hugo,
>
> what do you mean with "Inject"? (I guess is not referring to Crux Inject
> metadata)
>
> El vie., 2 oct. 2020 a las 10:11, Hugo Ferreira (<[email protected]>)
> escribió:
>
> > Hi,
> >
> > I have 2 JS libraries to inject as externs.
> > Library 1 has no dependecies.
> > Library 2 depends on library 1.
> >
> > If I inject library 1 and then library 2, I get an error on console.
> >
> > The workaround that I find was:
> > On my JS injections block:
> > Add library 1
> > On window.onload = function() add library 2.
> >
> > This is thw way to go or there is a better way to do this ?
> >
>
>
> --
> Carlos Rovira
> http://about.me/carlosrovira
>

Reply via email to