Closed JohnBergman closed 5 years ago
Hi @JohnBergman, that is a weird error! Do you use Browser Link by any chance? Could you disable it, and try again, just in case that is what is breaking the JS file?
I have used a shorthand object declaration, perhaps whatever tool is parsing the file does not like that.. Can you replace the contents of the file with the following code, to check if that helps?
angular.module("umbraco.resources").factory("uSplitManageResource",
function ($http) {
var controllerPath = "backoffice/uSplit/Manage/";
return {
getExperiment: function (id) {
return $http.get(controllerPath + "GetExperimentAsync/" + id);
},
createExperiment: function(id) {
return $http.get(controllerPath + "CreateExperimentAsync/" + id);
},
addVariation: function(experimentId, nodeId) {
return $http.post(controllerPath + "AddVariationAsync/",
{
experimentId: experimentId,
nodeId: nodeId
});
},
deleteExperiment: function(id) {
return $http.delete(controllerPath + "DeleteExperimentAsync/" + id);
},
deleteVariation: function (experimentId, variationName) {
return $http.post(controllerPath + "DeleteVariationAsync/",
{
experimentId: experimentId,
variationName: variationName
});
},
setSegment: function (experimentId, providerKey, value) {
return $http.post(controllerPath + "SetSegmentAsync/", {
experimentId: experimentId,
providerKey: providerKey,
value: value
});
},
start: function (experimentId) {
return $http.post(controllerPath + "StartExperimentAsync/" + experimentId);
},
stop: function (experimentId) {
return $http.post(controllerPath + "StopExperimentAsync/" + experimentId);
}
}
}
);
No change with browserlink disabled :-(
@JohnBergman I realise this was a while ago, but did you get this error in your browser or in Visual Studio?
It's possible that Visual Studio was trying to build the JS when you first run?
Browser. For now, I only have it installed in a test instance; but I'd like to get it installed back in the main one in the next month or so.
@HarveyWilliams Are you getting the same error?
@ondrejpialek Nope! I'm just interested.
Ok, having spent some time thinking about this... :)
This one is caused by having a return
statement on line 13 that does follows with a {
on the next line. This might be ambiguous in some cases as JS does not require semicolons at the end of statements. I don't think it's ambiguous in this case, but VS is probably being overprotective.
Not gonna fix myself (just moving the {
at the end of the prev line should solve this), but if someone want's do submit a PR feel free :)
When running inside Visual Studio, I keep getting this error
JavaScript critical error at line 13, column 33 in http://localhost:41573/App_Plugins/uSplit/backoffice/uSplitManageResource.js?cdv=943451263\n\nSCRIPT1003: Expected ':'
I have not configured a split test as of yet.