View Issue Details

IDProjectCategoryView StatusLast Update
0034847pas2jsrtlpublic2020-02-09 19:16
ReportersilvioprogAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionno change required 
Product VersionProduct Build 
Target VersionFixed in Version 
Summary0034847: [PATCH] libjquery.pas: added .on() event
DescriptionHello,

the attached patch adds the jQuery.on()[1] event to the library binding. I'll add more events[2] as soon as possible.

best,

[1] http://api.jquery.com/on
[2] http://api.jquery.com/category/events
TagsNo tags attached.
Fixed in Revision
Attached Files
  • libjquery.pas.diff (1,525 bytes)
    Index: packages/rtl/libjquery.pas
    ===================================================================
    --- packages/rtl/libjquery.pas	(revision 254)
    +++ packages/rtl/libjquery.pas	(working copy)
    @@ -1,3 +1,17 @@
    +{
    +    This file is part of the Pas2JS run time library.
    +    Copyright (c) 2017-2019 by Michael Van Canneyt, Silvio Clecio (silvioprog),
    +    members of the Pas2JS development team.
    +
    +    See the file COPYING.FPC, included in this distribution,
    +    for details about the copyright.
    +
    +    This program is distributed in the hope that it will be useful,
    +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    +
    + **********************************************************************}
    +
     unit libjquery;
     
     {$mode objfpc}
    @@ -428,6 +442,11 @@
         function Width(aValue: Integer) : TJQuery;overload;
         function Width(aValue: String) : TJQuery;overload;
         function Width(aHandler: TJQueryWidthHandler) : TJQuery;overload;
    +
    +    function _on(const events: String; handler: TJSEvent): TJQuery; overload; external name 'on';
    +    function _on(const events: String; const selector: String; handler: TJSEvent): TJQuery; overload; external name 'on';
    +    function _on(const events: String; const selector: String; data: JSValue; handler: TJSEvent): TJQuery; overload; external name 'on';
    +
         Property ready : TJSPromise Read FReady;
         // These should actually be class properties ?
         property cssHooks : TJSObject Read FCSSHooks;
    
    libjquery.pas.diff (1,525 bytes)
  • 02-libjquery.pas.diff (1,546 bytes)
    Index: packages/rtl/libjquery.pas
    ===================================================================
    --- packages/rtl/libjquery.pas	(revision 254)
    +++ packages/rtl/libjquery.pas	(working copy)
    @@ -1,3 +1,17 @@
    +{
    +    This file is part of the Pas2JS run time library.
    +    Copyright (c) 2017-2019 by Michael Van Canneyt, Silvio Clecio (silvioprog),
    +    members of the Pas2JS development team.
    +
    +    See the file COPYING.FPC, included in this distribution,
    +    for details about the copyright.
    +
    +    This program is distributed in the hope that it will be useful,
    +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    +
    + **********************************************************************}
    +
     unit libjquery;
     
     {$mode objfpc}
    @@ -428,6 +442,11 @@
         function Width(aValue: Integer) : TJQuery;overload;
         function Width(aValue: String) : TJQuery;overload;
         function Width(aHandler: TJQueryWidthHandler) : TJQuery;overload;
    +
    +    function _on(const events: String; handler: TJSEventHandler): TJQuery; overload; external name 'on';
    +    function _on(const events: String; const selector: String; handler: TJSEventHandler): TJQuery; overload; external name 'on';
    +    function _on(const events: String; const selector: String; data: JSValue; handler: TJSEventHandler): TJQuery; overload; external name 'on';
    +
         Property ready : TJSPromise Read FReady;
         // These should actually be class properties ?
         property cssHooks : TJSObject Read FCSSHooks;
    
    02-libjquery.pas.diff (1,546 bytes)

Activities

silvioprog

2019-01-10 18:19

reporter  

libjquery.pas.diff (1,525 bytes)
Index: packages/rtl/libjquery.pas
===================================================================
--- packages/rtl/libjquery.pas	(revision 254)
+++ packages/rtl/libjquery.pas	(working copy)
@@ -1,3 +1,17 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2017-2019 by Michael Van Canneyt, Silvio Clecio (silvioprog),
+    members of the Pas2JS development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
 unit libjquery;
 
 {$mode objfpc}
@@ -428,6 +442,11 @@
     function Width(aValue: Integer) : TJQuery;overload;
     function Width(aValue: String) : TJQuery;overload;
     function Width(aHandler: TJQueryWidthHandler) : TJQuery;overload;
+
+    function _on(const events: String; handler: TJSEvent): TJQuery; overload; external name 'on';
+    function _on(const events: String; const selector: String; handler: TJSEvent): TJQuery; overload; external name 'on';
+    function _on(const events: String; const selector: String; data: JSValue; handler: TJSEvent): TJQuery; overload; external name 'on';
+
     Property ready : TJSPromise Read FReady;
     // These should actually be class properties ?
     property cssHooks : TJSObject Read FCSSHooks;
libjquery.pas.diff (1,525 bytes)

silvioprog

2019-01-10 18:23

reporter   ~0113307

Hm... the "handler" argument should be a TJSEventHandler instead ofTJSEvent. Please discard the first patch, I'm going to send a new one ...

silvioprog

2019-01-10 18:24

reporter  

02-libjquery.pas.diff (1,546 bytes)
Index: packages/rtl/libjquery.pas
===================================================================
--- packages/rtl/libjquery.pas	(revision 254)
+++ packages/rtl/libjquery.pas	(working copy)
@@ -1,3 +1,17 @@
+{
+    This file is part of the Pas2JS run time library.
+    Copyright (c) 2017-2019 by Michael Van Canneyt, Silvio Clecio (silvioprog),
+    members of the Pas2JS development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
 unit libjquery;
 
 {$mode objfpc}
@@ -428,6 +442,11 @@
     function Width(aValue: Integer) : TJQuery;overload;
     function Width(aValue: String) : TJQuery;overload;
     function Width(aHandler: TJQueryWidthHandler) : TJQuery;overload;
+
+    function _on(const events: String; handler: TJSEventHandler): TJQuery; overload; external name 'on';
+    function _on(const events: String; const selector: String; handler: TJSEventHandler): TJQuery; overload; external name 'on';
+    function _on(const events: String; const selector: String; data: JSValue; handler: TJSEventHandler): TJQuery; overload; external name 'on';
+
     Property ready : TJSPromise Read FReady;
     // These should actually be class properties ?
     property cssHooks : TJSObject Read FCSSHooks;
02-libjquery.pas.diff (1,546 bytes)

silvioprog

2019-01-10 18:25

reporter   ~0113308

Please consider only the patch "02-libjquery.pas.diff" (the " libjquery.pas.diff" is wrong).

Michael Van Canneyt

2020-02-09 19:16

administrator   ~0120978

These have been added meanwhile, but the name is on_ instead of _on.

Issue History

Date Modified Username Field Change
2019-01-10 18:19 silvioprog New Issue
2019-01-10 18:19 silvioprog File Added: libjquery.pas.diff
2019-01-10 18:23 silvioprog Note Added: 0113307
2019-01-10 18:24 silvioprog File Added: 02-libjquery.pas.diff
2019-01-10 18:25 silvioprog Note Added: 0113308
2019-01-22 08:36 Michael Van Canneyt Assigned To => Michael Van Canneyt
2019-01-22 08:36 Michael Van Canneyt Status new => assigned
2020-02-09 19:16 Michael Van Canneyt Status assigned => resolved
2020-02-09 19:16 Michael Van Canneyt Resolution open => no change required
2020-02-09 19:16 Michael Van Canneyt Note Added: 0120978