I've got a problem with v2 of ziggeo.
Following is my case:
I'm using ziggeo from that url:
//assets-cdn.ziggeo.com/v2-stable/ziggeo.js
I initialise it with the following code:
new ZiggeoApi.V2.Application({
token: {TOKEN},
language: {LANGUAGE},
webrtc_streaming: true
});
And if I output 'ZiggeoApi' the following appears:
So the main problem is now that 'Events' doesnt exist in the object. And if I use the following code which I got from your site (Here: https://ziggeo.com/docs/sdks/javascript/browser-integration/embed-methods#javascript-version=v2) with that at the beginning:
ZiggeoApi.Events.on("system_ready", function() {
... it doesn't work and produces an error. Because of the missing 'Events' Attribute I'm also not able to use any other functionality which is connected with events.
When I change the version to v1-stable in the url it's working.
Is this a bug or what am I doing wrong?
I've found a solution. You have to do it this way:
Initialise the app:
let app = new ZiggeoApi.V2.Application({
token: {TOKEN},
language: {LANGUAGE},
webrtc_streaming: true
});
Then call the 'on ready' function directly on the initialised object:
app.on('ready', function() {
// do what you want!
});
That's the way how you have to do it with Ziggeo V2.
Related
I am fixing lint errors using Microsoft's tslint-microsoft-contrib. It throws the following error which I think a false alarm.
Backbone set() called outside of owning model
var mapSet = new Map();
mapSet.set('base', {
id: 'base',
label: 'label',
type: 'type'
}); // Error shown here: Backbone set() called outside of owning model: mapSet.set('base'...) (no-backbone-get-set-outside-model)
Is there any way to fix this?
According to this issue comment from tslint-microsoft-contrib the rule you are mentioning is a rule that is specific to Backbone.js and since your case doesn't have anything to do with Backbone, you can just disable it in your tslint.json.
When I try to pass language dynamically from select dropdown list, It shows following error
Uncaught TypeError: Cannot read property 'properties' of undefined at changeLanguage
Where changeLanguage is my function as follows:
function changeLanguage(lang)
{
lang = lang || "en_EN"; // if no language is set, use browser default
jQuery.i18n.properties({
path : 'language',
mode : 'both', language: lang,
name: 'Messages',
callback: refresh_i18n });
}
Following are the pictures of it:
Dropdown image
Console error
What is wrong with the code?
Please do suggest!
Thanks
UPDATE:
FOR MORE EXPLANATION:
This is my index file and initially I call it with onload it works fine.
<script>
function refresh_i18n() {
console.log('Some code...')
}
function changeLanguage(lang) {
lang = lang || "en_EN";
jQuery.i18n.properties({
path : 'js/libs/language',
mode : 'both',
language: lang,
callback: refresh_i18n
});
}
changeLanguage("en_US");
</script>
but when i call by changing dropdown like:
$('#selectLanguage').change(function(){
changeLanguage(this.value);
});
It gives above error
Probrably the i18n library is loading before the jquery (problems haha).
So, put the jQuery loading in the head of the html and the plugin i18n (and others, if you are using) in the body (I suggest in the end of body) of the html.
That must solve the problem.
I have been fiddling for ages with custom handlebars helpers such as:
Handlebars.registerHelper('markdowner', function (input) {
var converter = new Showdown.converter({ extensions: 'tables' });
return converter.makeHtml(input);
});
yet i get thrown:
Uncaught TypeError: Cannot call method 'replace' of undefined
from showdown.js when trying to call the helper.
I have also tried redefining the converter when Meteor loads, but it is ignored - any ideas on how to get showdown convertors/extensions running would be greatly appreciated.
You need to provide the extensions as an array and also you need to refer to that extension as 'table' rather than 'tables' (based on the table.js file within the Showdown gitgub repository as below).
var converter = new Showdown.converter({ extensions: ['table'] });
I've just implemented this myself after having the same error you had.
When the extension is loaded you should be able to run this from the console and have it return something.
$ window.Showdown.extensions.table
To test it's working from the console try this:
new Showdown.converter({extensions:['table']}).makeHtml("| A | B | C | \n |-|-|").htmlSafe()
should output
SafeString {string: "<table>↵<thead>↵<tr>↵<th id="a" style="text-align:…C </th>↵</tr>↵</thead>↵↵<tbody>↵</tbody>↵</table>", toString: function}
References
table.js - https://raw.githubusercontent.com/coreyti/showdown/master/src/extensions/table.js
I found the array reference here: http://www.sluse.com/view/20863978
I have the following piece of code
<div class="cv-uploader" id="customid">Upload CV</div>
$('.cv-uploader').fineUploader({
debug: true,
request: {
endpoint: '/process',
params:{ elementId:$(this).attr('id') }
},
//some other code
});
I need to send in the request parameters the ID of the element that triggered fineuploader. I tried $(this).attr('id') but it wont work.
Please help
Thanks
Sergiu
This is more of a general JavaScript question then a Fine Uploader question. The problem is that you are misunderstanding how context works in JavaScript. In your code, this will always refer to the window object. Obviously, this is not what you want.
You can either do this:
$('.cv-uploader').fineUploader({
debug: true,
request: {
endpoint: '/process',
params:{ elementId:$('.cv-uploader').attr('id') }
},
//some other code
});
...or this:
$('.cv-uploader').fineUploader({
debug: true,
request: {
endpoint: '/process'
},
//some other code
})
.on("submitted", function(event, id) {
$(this).fineUploader('setParams', {elementId: $(this).attr('id')}, id);
});
The latter example is possible as Fine Uploader's jQuery plug-in wrapper sets the context of any jQuery event handlers you bind to a Fine Uploader instance as the jQuery object that represents that element.
However, I would recommend the first approach as it is more efficient.
I am following a very simple tutorial by Steve Sanderson and it seems like the scaffolded script does not call my webapi:
cshtml code:
#(Html.UpshotContext().DataSource<Yoga.Controllers.YogaController>(x => x.GetAllBugs()))
Generated script:
upshot.dataSources = upshot.dataSources || {};
upshot.metadata({...});
upshot.dataSources.AllBugs = upshot.RemoteDataSource({
providerParameters: { url: "/api/Yoga/", operationName: "GetAllBugs" },
entityType: "BugView:#Yoga.Models",
bufferChanges: false,
dataContext: undefined,
mapping: {}
});
and it was called after page is loaded:
$(function() {
var dataSource = upshot.dataSources.AllBugs;
dataSource.refresh(function(results)){
//error here, `result` is an null object
alert(results);
});
});
I placed a breakpoint at my GetAllBugs() member in the controller, and it was never hit.
However, when i visit the uri directly, http://localhost/api/yoga/getallbugs i get the expected result. (and the breakpoint was hit)
I can't seem to figure out what is going on with the scaffolded upshot script.
Thanks
Try the following code:
dataSource.refresh(function (entities, total){
alert(entities);
});
Also, go to the Network tab of firebug/developer console, or start up Fiddler, and check whether the request to the controller is actually sent or not. If it is sent, then your problem is on controller, probably not mapping the action correctly.