Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 9e17971f
authored
Sep 20, 2014
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: add deprecation warnings to event emitter style callbacks, closes #2280
1 parent
d6c9e0d1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletions
lib/promise.js
lib/promise.js
View file @
9e17971
...
...
@@ -3,7 +3,13 @@
var
Promise
=
require
(
'sequelize-bluebird'
)
,
EventEmitter
=
require
(
'events'
).
EventEmitter
,
proxyEventKeys
=
[
'success'
,
'error'
,
'sql'
]
,
Utils
=
require
(
'./utils'
);
,
Utils
=
require
(
'./utils'
)
,
seen
=
{}
,
deprecated
=
function
(
message
)
{
if
(
seen
[
message
])
return
;
console
.
warn
(
message
);
seen
[
message
]
=
true
;
};
/**
* A slightly modified version of bluebird promises. This means that, on top of the methods below, you can also call all the methods listed on the link below.
...
...
@@ -75,6 +81,7 @@ SequelizePromise.prototype.emit = function(evt) {
*/
SequelizePromise
.
prototype
.
success
=
SequelizePromise
.
prototype
.
ok
=
function
(
fct
)
{
deprecated
(
'EventEmitter#success|ok is deprecated, please use promise-style instead.'
);
if
(
fct
.
length
>
1
)
{
return
this
.
spread
(
fct
);
}
else
{
...
...
@@ -100,6 +107,7 @@ SequelizePromise.prototype.ok = function(fct) {
SequelizePromise
.
prototype
.
failure
=
SequelizePromise
.
prototype
.
fail
=
SequelizePromise
.
prototype
.
error
=
function
(
fct
)
{
deprecated
(
'EventEmitter#failure|fail|error is deprecated, please use promise-style instead.'
);
return
this
.
then
(
null
,
fct
);
};
...
...
@@ -126,6 +134,7 @@ SequelizePromise.prototype.complete = function(fct) {
}
if
(
fct
.
length
>
2
)
{
deprecated
(
'EventEmitter#complete|done is deprecated, please use promise-style instead.'
);
return
this
.
spread
(
function
()
{
fct
.
apply
(
null
,
[
null
].
concat
(
Array
.
prototype
.
slice
.
call
(
arguments
)));
},
fct
);
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment