06 January 2014

I just got my first Chrome Extension published: Findmjob: Push Jobs to You

the basic was created with Extensionizr. it’s a very useful tool.

the source is at https://github.com/fayland/findmjob.com_chrome_extension

it’s pure javascript. use localStorage to store the options data and transfer data from background.js to browser_action.js (need JSON parse and stringify since it only accept strings.)

Notification is quite simple as below:

var notification = window.webkitNotifications.createNotification(
    '../../icons/icon48.png',            // The image.
    v.title,                       // The title.
    v.title      // The body.
notification.onclick = function() { // Open on click
    window.open(base_url + v.url + '?' + REF_STRING);
// Close after 20 secs
setTimeout(function() {
}, 20 * 1000);

and Badge Text in browserAction:

    text: data.updates.length.toString()

super simple. and works great.


blog comments powered by Disqus