Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
casperjs
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
75286e4d
...
75286e4d2c87e3d755b046158f1b348a2eab7841
authored
2012-06-06 06:21:28 +0200
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
added Casper.warn() to log and display warnings
1 parent
f0da4eda
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
modules/casper.js
modules/casper.js
View file @
75286e4
...
...
@@ -158,7 +158,7 @@ var Casper = function Casper(options) {
// deprecated feature event handler
this
.
on
(
'deprecated'
,
function
onDeprecated
(
message
)
{
this
.
echo
(
'[deprecated] '
+
message
,
'COMMENT'
);
this
.
warn
(
'[deprecated] '
+
message
);
});
// dispatching an event when instance has been constructed
...
...
@@ -1149,6 +1149,18 @@ Casper.prototype.visible = function visible(selector) {
};
/**
* Displays a warning message onto the console and logs the event.
*
* @param String message
* @return Casper
*/
Casper
.
prototype
.
warn
=
function
warn
(
message
)
{
this
.
log
(
message
,
"warning"
,
"phantom"
);
var
formatted
=
f
.
apply
(
null
,
[
"⚠ "
+
message
].
concat
([].
slice
.
call
(
arguments
,
1
)));
return
this
.
echo
(
formatted
,
'COMMENT'
);
};
/**
* Adds a new step that will wait for a given amount of time (expressed
* in milliseconds) before processing an optional next one.
*
...
...
@@ -1325,7 +1337,7 @@ Casper.prototype.waitWhileVisible = function waitWhileVisible(selector, then, on
* @since 0.6
*/
Casper
.
extend
=
function
(
proto
)
{
console
.
warn
(
'Casper.extend() has been deprecated since 0.6; check the docs'
);
this
.
warn
(
'Casper.extend() has been deprecated since 0.6; check the docs'
);
if
(
!
utils
.
isObject
(
proto
))
{
throw
new
CasperError
(
"extends() only accept objects as prototypes"
);
}
...
...
Please
register
or
sign in
to post a comment