OK


                    
                    
                

🔥 | Latest

9/11, Chrome, and Google: google-chrome-extension javascript share edit edited Oct 2 '14 at 16:41 asked Oct 2 '14 at 8:26 user1573618 784 2 12 .33 Your first sendMessage does not have a type field, I'd guess that is something your listener is going to break on ("cannot read property 'type' of undefined"). - gpgekko Oct 2 '14 at 8:53 Thanks for the suggestion, I updated the sendMessage to use to run. user1573618 Oct 2 '14 at 9:07 type: "initialise") but my extension logic still fails What error are you getting in the console? - gpgekko Oct 2 14 at 9:09 Ok, finally figured out how to see the console for the background.js. There is no error, I added a console.log(response) in my listener in background.js and I can see both my "initialise" and "notification" messages coming through. Do I need to return something in particular for my load message to work on the content script? user1573618 Oct 2 '14 at 9:11 add a comment 1 Answer active oldest votes The problem was caused because my listener in background.js was not returning a response. So the function response of my chrome.extension.sendMessage was never being executed. 7 I changed my background.js to be: chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { if (request.type chrome.notifications.create ( 'worktimer-notification ' , request.options, function == "worktimer - notification") sendResponse(; }); share edit answered Oct 2 '14 at 9:14 user1573618 784 2 12 33 add a comment Madlad helpfully replies to their own question!
9/11, Chrome, and Google: google-chrome-extension
 javascript
 share edit
 edited Oct 2 '14 at 16:41
 asked Oct 2 '14 at 8:26
 user1573618
 784
 2 12 .33
 Your first sendMessage does not have a type field, I'd guess that is something your listener is going to break
 on ("cannot read property 'type' of undefined"). - gpgekko Oct 2 '14 at 8:53
 Thanks for the suggestion, I updated the sendMessage to use
 to run. user1573618 Oct 2 '14 at 9:07
 type: "initialise") but my extension logic still fails
 What error are you getting in the console? - gpgekko Oct 2 14 at 9:09
 Ok, finally figured out how to see the console for the background.js. There is no error, I added a
 console.log(response) in my listener in background.js and I can see both my "initialise" and "notification"
 messages coming through. Do I need to return something in particular for my load message to work on the
 content script? user1573618 Oct 2 '14 at 9:11
 add a comment
 1 Answer
 active
 oldest
 votes
 The problem was caused because my listener in background.js was not returning a response. So the
 function response of my chrome.extension.sendMessage was never being executed.
 7
 I changed my background.js to be:
 chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
 if (request.type
 chrome.notifications.create ( 'worktimer-notification ' , request.options, function
 == "worktimer - notification")
 sendResponse(;
 });
 share edit
 answered Oct 2 '14 at 9:14
 user1573618
 784 2 12 33
 add a comment
Madlad helpfully replies to their own question!

Madlad helpfully replies to their own question!

Gif, Jealous, and Life: I'm committing suicide as you're reading this. Love You All. Till we meet again. and 183 others 581 Comments Sending you all the love and light. 1 13h Like Reply WOW, JUST WOW, I HAVE ACTUALLY MADE A POST LIKE THIS BEFORE AND I GOT 7 comments, GET 396? WELL LA DE FRICKIN DA. BUT WAIT.. THIS IS NOT ABOUT YOU. 8 Like Reply 13h don't think this is about the number of comments this is his life we are talking. I'm sorry but have a heart 5 Like Reply 13h go to hell O3 Like 13h Reply Then you should know how everyone felt who was concerned about you. There is no need for comments like this. I'm sorry you were ever at this point tho and wish you the best Like Reply 13h This is not the time. 5 Like 13h Reply go fuck yourself 2 Like Reply 13h please understand, this is so out of character for with you. If you are hurting, please private message me, and I will listen to you. But this is not the time or place. nothing to do 7 13h Like Reply this is not about YOU. 1 Like 13h Reply not the time. Not the time! Call anyone at any time for your help, But don't make this about you! 1 13h Like Reply It's not a contest... I'm sorry you are hurting but this is a life or death situation. 1 13h Like Reply not the time. Not a contest. Very inappropriate. Please pray. 0 2 Like Reply 13h WOW!! who the fuck makes this about them?! Check your narcissism! 34m Like Reply Write a reply... 13h Like Reply Oh, want me to call you? 13h Like Reply Write a reply... Have you or heard anything!? Reply 13h Like View 6 previous replies... Ugh ok thanks y'all! GIF Write a comment... 9+ Friend actually committed suicide, insane lady is jealous his post got more comments/likes than her “suicide post”
Gif, Jealous, and Life: I'm committing suicide as you're reading this.
 Love You All. Till we
 meet again.
 and 183 others 581 Comments
 Sending you all the love and light.
 1
 13h
 Like
 Reply
 WOW, JUST WOW, I HAVE ACTUALLY
 MADE A POST LIKE THIS BEFORE
 AND I GOT 7 comments,
 GET
 396? WELL LA DE FRICKIN DA. BUT
 WAIT..
 THIS IS NOT
 ABOUT YOU.
 8
 Like
 Reply
 13h
 don't think this
 is about the number of comments
 this is his life we are talking. I'm
 sorry but have a heart
 5
 Like Reply
 13h
 go to hell
 O3
 Like
 13h
 Reply
 Then you should know how
 everyone felt who was concerned
 about you. There is no need for
 comments like this. I'm sorry you
 were ever at this point tho and
 wish you the best
 Like
 Reply
 13h
 This is not the time.
 5
 Like
 13h
 Reply
 go fuck yourself
 2
 Like
 Reply
 13h
 please
 understand, this is so out of
 character for
 with you. If you are hurting, please
 private message me, and I will
 listen to you. But this is not the
 time or place.
 nothing to do
 7
 13h
 Like
 Reply
 this is not about YOU.
 1
 Like
 13h
 Reply
 not the time.
 Not the time! Call anyone at any
 time for your help,
 But don't make this about you!
 1
 13h
 Like
 Reply
 It's not a contest... I'm sorry you
 are hurting but this is a life or
 death situation.
 1
 13h Like Reply
 not the time.
 Not a contest. Very inappropriate.
 Please pray.
 0 2
 Like Reply
 13h
 WOW!! who the
 fuck makes this about them?!
 Check your narcissism!
 34m
 Like
 Reply
 Write a reply...
 13h
 Like
 Reply
 Oh, want me to call you?
 13h
 Like
 Reply
 Write a reply...
 Have you
 or
 heard anything!?
 Reply
 13h
 Like
 View 6 previous replies...
 Ugh ok thanks y'all!
 GIF
 Write a comment...
 9+
Friend actually committed suicide, insane lady is jealous his post got more comments/likes than her “suicide post”

Friend actually committed suicide, insane lady is jealous his post got more comments/likes than her “suicide post”