I am following a jsfiddle example here where Kloudless API was used. link Kloudless API in Javascript
Using the code below with the jsfiddle code I place it on my template rendered but sadly it did not work
Template.kloudless.rendered = function() {
var explorer = window.Kloudless.explorer({
app_id: 'iCZ_ICMy43H0NSoz0QbLvmyjzCHf2frAOPaBfWVgh9_vrFIM',
multiselect: true,
computer: true
});
explorer.on('success', function(files) {
$("#file-info > pre").replaceWith('<pre>' + JSON.stringify(files, null, 2) + '</pre>');
});
explorer.choosify($('#chooser'));
var files = [{
url: "https://s3-us-west-2.amazonaws.com/static-assets.kloudless.com/static/logo_white.png",
name: "kloudless-logo.png"
}];
explorer.savify($("#saver"), files);
}
If I placed the the code as shown below it will work. Is there a way to write the code in a more Meteor way, like the following code?
<header>
<title>myapp</title>
<script type="text/javascript">
var explorer = window.Kloudless.explorer({
app_id: 'iCZ_ICMy43H0NSoz0QbLvmyjzCHf2frAOPaBfWVgh9_vrFIM',
multiselect: true,
computer: true
});
explorer.on('success', function(files) {
$("#file-info > pre").replaceWith('<pre>' + JSON.stringify(files, null, 2) + '</pre>');
});
explorer.choosify($('#chooser'));
var files = [{
url: "https://s3-us-west-2.amazonaws.com/static-assets.kloudless.com/static/logo_white.png",
name: "kloudless-logo.png"
}];
explorer.savify($("#saver"), files);
</script>
</header>