- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2015 04:26 AM
Hi,
Trying to understand some basics of prototyping in ServiceNow and looking for answer - What does the following string mean?
WFActivityHandler.prototype.initialize.call(this);
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2015 04:42 AM
Hi
Prototype is, in fact, a key feature of JavaScript - http://javascriptissexy.com/javascript-prototype-in-plain-detailed-language/
The call function refers to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call
In short, you can roughly read it as "Considering this as the current subject, treat it as WFActivityHandler and execute the initialize method with no parameter"
It is particularly useful if you need to handle inheritance with JavaScript, when you can't call a method of the super class with the super keyword like Java.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2015 04:42 AM
Hi
Prototype is, in fact, a key feature of JavaScript - http://javascriptissexy.com/javascript-prototype-in-plain-detailed-language/
The call function refers to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call
In short, you can roughly read it as "Considering this as the current subject, treat it as WFActivityHandler and execute the initialize method with no parameter"
It is particularly useful if you need to handle inheritance with JavaScript, when you can't call a method of the super class with the super keyword like Java.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2015 05:32 AM
OK, then could you please explain what specifically it does in "Wait for Condition" activity?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2015 07:37 PM
Hi Andrii,
Deryck gave you a couple of resources that you can use to learn about prototypical inheritence in JavaScript. It's not a small question to answer, but if you go through the links he gave you, you will learn how it works, and then can understand how it is used in the context of the Wait for Condition activity. Until you've familiarzed yourself with the concepts and their applications, trying to explain how it is used in this case would require covering all of that information first.
Since he already gave you some good links to the topics, you should look there first.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2015 12:54 AM
Hi Cory,
Yes, his answer if helpful, however i think I asked the wrong question - I'm not looking for basic that I know already - I'm looking for specific application of prototype thinking in specific example.
Anyway, I'm in progress