Created
March 27, 2019 23:04
-
-
Save punamdahiya/a78acea2b3095f91e447fbbdd3b806a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async addBookmark(action) { | |
const {url} = action.data; | |
let data; | |
try { | |
// Check if url is an existing bookmark | |
data = await PlacesUtils.bookmarks.fetch({url}); | |
} catch (err) { | |
Cu.reportError(err); | |
} | |
if (data) { | |
// console.log("On Rebookmark", data); | |
this.store.dispatch({type: at.PLACES_LINKS_CHANGED}); | |
this.store.dispatch(ac.BroadcastToContent({ | |
type: at.PLACES_BOOKMARK_ADDED, | |
data: { | |
bookmarkGuid: data.guid, | |
bookmarkTitle: data.title, | |
url, | |
}, | |
})); | |
return; | |
} | |
NewTabUtils.activityStreamLinks.addBookmark(action.data, action._target.browser.ownerGlobal); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment