mirror of
https://github.com/flynx/types.js.git
synced 2025-10-29 02:20:07 +00:00
better introspection...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
cce5eaf1e7
commit
8965fdacd2
24
event.js
24
event.js
@ -169,9 +169,11 @@ function(name, func, options={}){
|
||||
return h !== func
|
||||
&& h.__event_original_handler__ !== func }))
|
||||
return this },
|
||||
// remove the handle from the arguments...
|
||||
toString: function(){
|
||||
return func.toString()
|
||||
.replace(/^(function[^(]*\()[^,)]*, ?/, '$1') },
|
||||
return 'Eventfull '
|
||||
+(func.toString()
|
||||
.replace(/^(function[^(]*\()[^,)]*, ?/, '$1')) },
|
||||
})
|
||||
|
||||
Object.defineProperty(method, 'name', {
|
||||
@ -247,9 +249,10 @@ function(name, func, options={}){
|
||||
// still need to base the doc on the user's func...
|
||||
toString: function(){
|
||||
return func ?
|
||||
func.toString()
|
||||
.replace(/^(function[^(]*\()[^,)]*, ?/, '$1')
|
||||
: `function ${name}(){}`},
|
||||
'Event '
|
||||
+func.toString()
|
||||
.replace(/^(function[^(]*\()[^,)]*, ?/, '$1')
|
||||
: `Event function ${name}(){}`},
|
||||
}) }
|
||||
|
||||
|
||||
@ -258,9 +261,14 @@ function(name, func, options={}){
|
||||
var PureEvent =
|
||||
module.PureEvent =
|
||||
function(name, options={}){
|
||||
return Event(name, function(handle, trigger){
|
||||
trigger === module.TRIGGER
|
||||
|| handle(false) }, options)}
|
||||
return object.mixin(
|
||||
Event(name, function(handle, trigger){
|
||||
trigger === module.TRIGGER
|
||||
|| handle(false) }, options),
|
||||
{
|
||||
toString: function(){
|
||||
return `PureEvent ${name}(){}`},
|
||||
}) }
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ig-types",
|
||||
"version": "5.0.10",
|
||||
"version": "5.0.11",
|
||||
"description": "Generic JavaScript types and type extensions...",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user