diff --git a/utils/pas2js/docs/translation.html b/utils/pas2js/docs/translation.html
index bfe20bf3ce..f857863781 100644
--- a/utils/pas2js/docs/translation.html
+++ b/utils/pas2js/docs/translation.html
@@ -2178,8 +2178,15 @@ function(){
rtl = {
...
createCallback: function(scope, fn){
- var cb = function(){
- return scope[fn].apply(scope,arguments);
+ var cb;
+ if (typeof(fn)==='string'){
+ cb = function(){
+ return scope[fn].apply(scope,arguments);
+ };
+ } else {
+ cb = function(){
+ return fn.apply(scope,arguments);
+ };
};
cb.scope = scope;
cb.fn = fn;
@@ -2195,9 +2202,18 @@ rtl = {
- You can assign a nested procedure to procedure variable.
You don't need and you must not add the FPC "is nested" modifier.
- - A procedural typed declared as 'reference to' accepts in pas2js procedures,
+
- In pas2js a procedural typed declared as 'reference to' accepts procedures,
local procedures and methods. Delphi only supports capturing procedures and methods.
FPC 3.0.4 does not support reference-to.
+ - In pas2js the calling convention safecall has a special meaning:
+ Assigning a procedure/method, uses rtl.createSafeCallback instead of
+ createCallback, enclosing a call in a try..catch block. When
+ an exception is thrown by JS, it is caught and delegated to
+ rtl.handleUncaughtException(err).
+ For example:
+ aButtonElement.OnClick:=@DoClick; uses rtl.createSafeCallback
+ aButtonElement.OnClick:=SomeElement.OnClick; does not.
+