Skip to content

Modules

Aferdita Muriqi edited this page Nov 11, 2019 · 2 revisions

R2D2BC

Modules

Bookmarks

<script>
    
    D2Reader.load({
        url: new URL("http....."),
        rights: {
            enableBookmarks: true
        },
        api: {
            addBookmark: function (bookmark) {
                return new Promise(function (resolve, reject) {
                    bookmark.id = Math.random()
                    resolve(
                        bookmark
                    )
                })
            },
            deleteBookmark: function (bookmark) {
                return new Promise(function (resolve, reject) {
                    resolve(
                        bookmark
                    )
                })
            }
        }
    }).then(instance => {
        console.log("D2Reader loaded ", instance);
    }).catch(error => {
        console.error("error.message ", error.message);
    });

</script>

Bookmark API

D2Reader.saveBookmark()

<button onclick="javascript:D2Reader.saveBookmark()">add bookmark</button>

D2Reader.deleteBookmark(<#json#>)

<button onclick="javascript:D2Reader.deleteBookmark({id:123})">delete bookmark</button>
Clone this wiki locally