Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
0b82a05a
Commit
0b82a05a
authored
Jan 31, 2015
by
Marek Kotewicz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
events
parent
80c97ca2
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
19 deletions
+63
-19
ethereum.js
dist/ethereum.js
+7
-7
ethereum.js.map
dist/ethereum.js.map
+3
-3
ethereum.min.js
dist/ethereum.min.js
+1
-1
event.html
example/event.html
+45
-1
filter.js
lib/filter.js
+2
-4
web3.js
lib/web3.js
+5
-3
No files found.
dist/ethereum.js
View file @
0b82a05a
...
...
@@ -580,11 +580,9 @@ var web3 = require('./web3'); // jshint ignore:line
/// should be used when we want to watch something
/// it's using inner polling mechanism and is notified about changes
/// TODO: change 'options' name cause it may be not the best matching one, since we have events
var
Filter
=
function
(
options
,
i
ndexed
,
i
mpl
)
{
var
Filter
=
function
(
options
,
impl
)
{
if
(
options
.
_isEvent
)
{
return
options
(
indexed
);
}
else
if
(
typeof
options
!==
"string"
)
{
if
(
typeof
options
!==
"string"
)
{
// topics property is deprecated, warn about it!
if
(
options
.
topics
)
{
...
...
@@ -1432,7 +1430,10 @@ var web3 = {
/// @param filter may be a string, object or event
/// @param indexed is optional, this may be an object with optional event indexed params
watch
:
function
(
filter
,
indexed
)
{
return
new
web3
.
filter
(
filter
,
indexed
,
ethWatch
);
if
(
filter
.
_isEvent
)
{
return
filter
(
indexed
);
}
return
new
web3
.
filter
(
filter
,
ethWatch
);
}
},
...
...
@@ -1443,9 +1444,8 @@ var web3 = {
shh
:
{
/// @param filter may be a string, object or event
/// @param indexed is optional, this may be an object with optional event indexed params
watch
:
function
(
filter
,
indexed
)
{
return
new
web3
.
filter
(
filter
,
indexed
,
shhWatch
);
return
new
web3
.
filter
(
filter
,
shhWatch
);
}
},
...
...
dist/ethereum.js.map
View file @
0b82a05a
This diff is collapsed.
Click to expand it.
dist/ethereum.min.js
View file @
0b82a05a
This diff is collapsed.
Click to expand it.
example/event.html
View file @
0b82a05a
...
...
@@ -27,25 +27,57 @@
var
contract
=
web3
.
eth
.
contract
(
address
,
desc
);
function
test1
()
{
// "{"topic":["0x83c9849c","0xc4d76332"],"address":"0x01"}"
web3
.
eth
.
watch
(
contract
).
changed
(
function
(
res
)
{
});
};
function
test2
()
{
// "{"topic":["0x83c9849c"],"address":"0x01"}"
web3
.
eth
.
watch
(
contract
.
Event
).
changed
(
function
(
res
)
{
});
};
function
test3
()
{
// "{"topic":["0x83c9849c"],"address":"0x01"}"
contract
.
Event
().
changed
(
function
(
res
)
{
});
};
function
test4
()
{
// "{"topic":["0x83c9849c","0000000000000000000000000000000000000000000000000000000000000045"],"address":"0x01"}"
contract
.
Event
({
a
:
69
}).
changed
(
function
(
res
)
{
});
};
function
test5
()
{
// "{"topic":["0x83c9849c",["0000000000000000000000000000000000000000000000000000000000000045","000000000000000000000000000000000000000000000000000000000000002a"]],"address":"0x01"}"
contract
.
Event
({
a
:
[
69
,
42
]}).
changed
(
function
(
res
)
{
});
};
function
test6
()
{
// "{"topic":["0x83c9849c","000000000000000000000000000000000000000000000000000000000000001e"],"max":100,"address":"0x01"}"
contract
.
Event
({
a
:
30
},
{
max
:
100
}).
changed
(
function
(
res
)
{
});
};
function
test7
()
{
// "{"topic":["0x83c9849c","000000000000000000000000000000000000000000000000000000000000001e"],"address":"0x01"}"
web3
.
eth
.
watch
(
contract
.
Event
,
{
a
:
30
}).
changed
(
function
(
res
)
{
});
};
// not valid
// function test
4
() {
// function test
X
() {
// web3.eth.watch([contract.Event, contract.Event2]).changed(function (res) {
// });
// };
...
...
@@ -63,5 +95,17 @@
<div>
<button
type=
"button"
onClick=
"test3();"
>
test3
</button>
</div>
<div>
<button
type=
"button"
onClick=
"test4();"
>
test4
</button>
</div>
<div>
<button
type=
"button"
onClick=
"test5();"
>
test5
</button>
</div>
<div>
<button
type=
"button"
onClick=
"test6();"
>
test6
</button>
</div>
<div>
<button
type=
"button"
onClick=
"test7();"
>
test7
</button>
</div>
</body>
</html>
lib/filter.js
View file @
0b82a05a
...
...
@@ -28,11 +28,9 @@ var web3 = require('./web3'); // jshint ignore:line
/// should be used when we want to watch something
/// it's using inner polling mechanism and is notified about changes
/// TODO: change 'options' name cause it may be not the best matching one, since we have events
var
Filter
=
function
(
options
,
i
ndexed
,
i
mpl
)
{
var
Filter
=
function
(
options
,
impl
)
{
if
(
options
.
_isEvent
)
{
return
options
(
indexed
);
}
else
if
(
typeof
options
!==
"string"
)
{
if
(
typeof
options
!==
"string"
)
{
// topics property is deprecated, warn about it!
if
(
options
.
topics
)
{
...
...
lib/web3.js
View file @
0b82a05a
...
...
@@ -282,7 +282,10 @@ var web3 = {
/// @param filter may be a string, object or event
/// @param indexed is optional, this may be an object with optional event indexed params
watch
:
function
(
filter
,
indexed
)
{
return
new
web3
.
filter
(
filter
,
indexed
,
ethWatch
);
if
(
filter
.
_isEvent
)
{
return
filter
(
indexed
);
}
return
new
web3
.
filter
(
filter
,
ethWatch
);
}
},
...
...
@@ -293,9 +296,8 @@ var web3 = {
shh
:
{
/// @param filter may be a string, object or event
/// @param indexed is optional, this may be an object with optional event indexed params
watch
:
function
(
filter
,
indexed
)
{
return
new
web3
.
filter
(
filter
,
indexed
,
shhWatch
);
return
new
web3
.
filter
(
filter
,
shhWatch
);
}
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment