File tree Expand file tree Collapse file tree 2 files changed +51
-0
lines changed Expand file tree Collapse file tree 2 files changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ module . exports = {
2
+ extends : [
3
+ 'unobtrusive' ,
4
+ 'eslint:recommended'
5
+ ] ,
6
+ plugins : [ ] ,
7
+ env : {
8
+ browser : true ,
9
+ node : true ,
10
+ } ,
11
+ globals : {
12
+ } ,
13
+ rules : {
14
+ semi : [ 2 , 'always' ] ,
15
+ quotes : [ 2 , 'single' ] ,
16
+ indent : [ 2 , 2 ] ,
17
+ 'linebreak-style' : [ 2 , 'unix' ] ,
18
+ 'brace-style' : [ 2 , '1tbs' ] ,
19
+ 'array-bracket-spacing' : [ 2 , 'never' ] ,
20
+ camelcase : [ 2 , { properties : 'always' } ] ,
21
+ 'keyword-spacing' : [ 2 ] ,
22
+ 'eol-last' : [ 2 ] ,
23
+ 'no-trailing-spaces' : [ 2 ] ,
24
+ 'no-process-env' : [ 'off' , 'always' ] ,
25
+ 'no-console' : [ 'off' , 'always' ]
26
+ }
27
+ } ;
28
+
Original file line number Diff line number Diff line change
1
+ document . addEventListener ( 'DOMContentLoaded' , ( ) => {
2
+ const xmlhttp = new XMLHttpRequest ( ) ;
3
+ xmlhttp . onreadystatechange = function ( ) {
4
+ if ( xmlhttp . readyState == XMLHttpRequest . DONE ) { // XMLHttpRequest.DONE == 4
5
+ if ( xmlhttp . status == 200 ) {
6
+ const tweets = JSON . parse ( xmlhttp . responseText ) ;
7
+ const latest = tweets . data [ 0 ] ;
8
+ const text = latest . text ;
9
+ const date = latest . created_at ;
10
+ document . querySelector ( '.tweettime' ) . innerHTML = date ;
11
+ document . querySelector ( '.message' ) . innerHTML = text ;
12
+ } else if ( xmlhttp . status == 400 ) {
13
+ console . log ( 'There was an error 400' ) ;
14
+ } else {
15
+ console . log ( 'something else other than 200 was returned' ) ;
16
+ // console.log(xmlhttp);
17
+ }
18
+ }
19
+ } ;
20
+ // let devUrl = 'http://localhost:3000';
21
+ xmlhttp . open ( 'GET' , 'https://basiljs-latest-tweets.now.sh/' , true ) ;
22
+ xmlhttp . send ( ) ;
23
+ } ) ;
You can’t perform that action at this time.
0 commit comments