This repository was archived by the owner on Jun 5, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +22
-18
lines changed Expand file tree Collapse file tree 2 files changed +22
-18
lines changed Original file line number Diff line number Diff line change 6969 </ details >
7070 </ dl >
7171 </ template >
72- < script src ='js/script.js '> </ script >
72+ < script src ='js/script.js?_=1526892615177 '> </ script >
7373 </ body >
7474</ html >
Original file line number Diff line number Diff line change 3737 get ( path ) {
3838 path = `${ this . owner } /${ this . repo } /${ path } ` ;
3939 let data = getCache ( path ) ;
40- if ( data ) return Promise . resolve ( data ) ;
40+ if ( data ) return Promise . resolve ( data ) . then ( dispatch ) ;
4141
4242 return fetch ( `${ api } /${ path } ` ) . then (
4343 ( resp ) => this . normalize ( resp )
4646 new CustomEvent ( 'gohub-catch' , { detail : data } )
4747 ) ;
4848 return data ;
49- } ) ;
49+ } ) . then ( dispatch ) ;
5050 }
5151
5252 normalize ( resp ) {
6767 slice ( 1 ) . toLowerCase ( ) ,
6868 text = Base64 . decode ( json . content ) ,
6969 content = ext === 'json' &&
70- JSON . parse ( text ) || text ,
71- data = storeCache (
72- url , {
73- owner, repo,
74- name : json . name ,
75- url : json . html_url ,
76- sha : json . sha ,
77- path,
78- ext,
79- content,
80- }
81- ) ;
82- document . dispatchEvent (
83- new CustomEvent ( 'gohub-got' , { detail : data } )
70+ JSON . parse ( text ) || text ;
71+
72+ return storeCache (
73+ url , {
74+ owner, repo,
75+ name : json . name ,
76+ url : json . html_url ,
77+ sha : json . sha ,
78+ path,
79+ ext,
80+ content,
81+ }
8482 ) ;
85- return data ;
8683 } ) ;
8784 }
8885 }
8986
87+ function dispatch ( data ) {
88+ document . dispatchEvent (
89+ new CustomEvent ( 'gohub-got' , { detail : data } )
90+ ) ;
91+ return data ;
92+ }
93+
9094 global . gohub = function ( owner , repo ) {
9195 if ( ! owner ) return gohub . prototype ;
9296 return new gohub ( owner , repo ) ;
You can’t perform that action at this time.
0 commit comments