Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DoorLock
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
felix
DoorLock
Commits
93551a29
Commit
93551a29
authored
Dec 14, 2017
by
朱建香
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取cid方法
parent
8a7a6d43
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
0 deletions
+54
-0
dev/src/public/unotify.js
+54
-0
No files found.
dev/src/public/unotify.js
0 → 100644
View file @
93551a29
/**
* @class
* unotify
*/
class
unotify
{
static
async
getCid
(
successCallback
,
errorCallback
){
var
a
=
null
;
try
{
a
=
await
this
.
getCidPeriotic
(
3
);
if
(
typeof
successCallback
==
'function'
){
successCallback
(
a
);
}
}
catch
(
err
){
console
.
log
(
err
);
if
(
typeof
errorCallback
==
'function'
){
errorCallback
(
a
);
}
}
}
static
getCidPeriotic
(
times
){
var
self
=
this
;
return
new
Promise
(
function
(
resolve
,
reject
){
var
i
=
0
;
var
cid
=
null
;
var
handle
=
null
;
i
++
;
cid
=
self
.
getCidOnce
(
i
);
if
(
cid
!=
null
||
i
>=
times
){
window
.
clearInterval
(
handle
);
resolve
(
cid
);
}
else
{
handle
=
setInterval
(
function
(){
i
++
;
cid
=
self
.
getCidOnce
(
i
);
if
(
cid
!=
null
||
i
>=
times
){
window
.
clearInterval
(
handle
);
resolve
(
cid
);
}
},
1000
);
}
});
}
static
getCidOnce
(
i
){
var
clientInfo
=
plus
.
push
.
getClientInfo
();
if
(
clientInfo
&&
clientInfo
.
hasOwnProperty
(
'clientid'
)
&&
clientInfo
.
clientid
){
return
(
clientInfo
.
clientid
);
}
else
{
return
(
null
);
}
}
}
export
default
unotify
;
\ No newline at end of file
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