I've been trying unsuccessfully to use the Greensock JavaScript library in my new Dart projects. Any one has experience or can recommend me a guide or tutorial from dart where someone successfully uses an external JS lib ?
Have a look at Using JavaScript from Dart: The js Library.
Just import the dart:js library, and then you would call greensock from Dart like this:
context['TweenMax'].callMethod("to",["#myDiv", 0.15, new JsObject.jsify({x:100})]);
When you import dart:js library, make sure you add interop.js to your HTML page as well below:
<script src="packages/browser/interop.js"></script>
Related
does anyone know how to use RxJs in widgets? create streams for example. the only thing that found it self.ctx.rxjs.of(). but there is no use. thanks
Try to use Static widget with any custom HTML, CSS and external JS libs
We have an application written entirely dart/polymer with quite a few polymer components. We use the custom tags in out index.html and compile to dart with pub build. The compile to javascript creates index.html of 24K lines. Original index.html is 150. The application works perfectly.
However we would like to distribute the code to third party sites so that they also can use the components with custom tags. Ideally by just linking to an already compiled script and simple using our custom tags in their pages.
I know this is possible without polymer. Question is does polymer support this? Is it possible to compile a polymer app and keep to a minimum amount of changes in the html file?
To reduce the problem to an example:
We would like our customers to be able to do some thing like this, without the use of dart sdk:
<head>
<script src="what_ever_required.js"></script>
<script src="our_application.js"></script>
</head>
<body>
<our-custom-tag></our-customer-tag>
<p>What ever else content</p>
</body>
Regards
That's currently not supported.
Currently an application that used Dart code needs to be compiled to JS as a whole at once. There is no way to build parts of a Dart application and compose an application from them later.
With the upcoming DDC (Dart Development Compiler) there might be a way to accomplish that. An experimental approach is https://pub.dartlang.org/packages/polymerize
I want to create a utils.js that contains all of my utility functions, which are used by many of my React components.
I try to export and import a Utilities class into my React component like this:
// utils. js
export default class Utilities;
// myComponent.es6.jsx
import someFunction from 'Utilities';
I receive errors like these:
Uncaught ReferenceError: require is not defined(anonymous function)
Uncaught ReferenceError: exports is not defined
How do I set up a separate utilities page that can then be imported into my React components?
I'm baffled -- thanks for any help you can provide!
your answer could be here. Basically, I believe it's because import export and require are not yet fully compatible with Rails and all browsers. That's why in most applications they use Babel transpiler or common JS stuff. Let me know if that helps
So I'm trying to use Polymer and Core Elements with Angular.dart and I'm running into a problem importing the HTML. The import statements need to be within the head tag, but I don't want to shove every import into the index.html.
Is there a way to add the imports/modify the header within each template?
you can make a import.html file for example and fill it with your app imports then import just that 1 file in the head of your app to keep from having hundreds of imports in the head.
i don't know if any methods for injecting headers work though.
How to add jQueryUI plugin to my Blogger (Blogspot) site?
I know I can download it and use it offline, but (as far as I know), you can't upload separate files to Blogspot, so I can't call them with src.
You can download it for offline purpose, but for online purpose you particularly don't have to upload it somewhere. You can use online jQuery libraries direclty and add this snippet code in the footer (Recommended) or header area of the template as per your requirements.
jQuery on Google APIS
Snippet: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
note: 1.2.5 and 1.2.4 are not hosted due to their short and unstable lives in the wild.
jQuery UI on Google APIS
Snippet: <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
note: This library depends on jQuery. You must also load jQuery before loading this module. Version 1.8.3 is not hosted due to its short life, and the alias 1.8.3 actually loads 1.8.4.
OR
Add this code from their official web:
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
you can use the custom gadget facility on the blogspot.com site in which you can easily use the javascript and jquery code in one file .
Upload somewhere else, or just link it from google hosted libraries,
https://developers.google.com/speed/libraries/devguide#jquery-ui