Adding initialize script include is not callable from client
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2016 02:52 AM
Hi
I have a script include like
var Util = Class.create();
Util.prototype = Object.extendsObject(AbstractAjaxProcessor, {
ExampleFunc: function(curr) {
}
.....
i wanted to call it from server side as well as from client so initialized it like
var Util = Class.create();
Util.prototype = Object.extendsObject(AbstractAjaxProcessor, {
initialize: function() { },
ExampleFunc: function(curr) {
}
.....
but when i add initialize: function() { }, i am unable to call the function from the client script and if i remove it its not callable form server
pl help!
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2016 02:55 AM
Hi,
If you want to make a script "Client callable", you can't have "initialize" function. This syntax works both using server and client.
var Util = Class.create();
Util.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
ExampleFunc: function(curr) {
},
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2016 03:02 AM
something is telling me that its not a good idea i tend to avoid global sort of inclusions your comments?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2017 02:42 AM
A workaround is to add a custom method, for example _init().
You can then call it after your script include. Example:
var TestCL = Class.create();
TestCL.prototype = Object.extendsObject(AbstractAjaxProcessor, {
_init: function() {
this.test = "initialized value";
},
run: function() {
return this.test;
},
type: 'TestCL'
});
TestCL.prototype._init();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2016 03:08 AM
Considering the new apps are mostly "scoped applications", there are chances that a new script include can be created with same name under different scope. So, to avoid ambiguity, its advisable to use "global".
Thanks
Rami Reddy