I was working on a javascript template that our UI developers can use. But I couldn't find a way to get rid of eval. Can someone show me a way to replace eval?
/*jslint browser:true, passfail:false, sloppy:true, indent:4, maxerr:1000*/
/*global $*/
var Main = {
Init: function () {
this.Helper.Import("Main.Sliders");
},
Helper: {
Import: function (classname) {
var objectToInit = eval(classname);
objectToInit.Init();
},
UserAgent: {
IsIphone: navigator.userAgent.match(/iPhone|iPod/i) !== null,
IsIos: navigator.userAgent.match(/iPhone|iPad|iPod/i) !== null,
IsAndroid: navigator.userAgent.match(/Android/i) !== null
}
},
Sliders: {
Init: function () {
alert('dada');
}
}
};
$(document).ready(function () {
Main.Init();
});