Skip to content
Chris Willoughby edited this page Oct 23, 2015 · 5 revisions

Trove.Picture

Trove.Picture is a class used to hold metadata on a picture. It is a subclass of Trove.Work.

It can be constructed with an init argument to request the data immediately:

    var my_picture = new Trove.Picture({
        init: 192402411,
        done: function(picture) {
            console.log(JSON.stringify(picture, null, '\t'));
        }
    });

or you can use the get() method to request the data at some later time:

    var my_picture = new Trove.Picture({
        done: function(picture) {
            console.log(JSON.stringify(picture, null, '\t'));
        }
    });

    my_picture.get({id: 192402411});

If you want to re-request data, perhaps with more included information, just call get() again with the includes and/or reclevel options (the id parameter is optional if specified earlier):

    my_picture.get({
        id: 192402411,
        reclevel: Trove.RECLEVEL.FULL
    });

You can also specify these on construction:

    function picture_done (picture) {
        console.log(JSON.stringify(picture, null, '\t'));
    }

    var my_picture = new Trove.Picture({
        init: 192402411,
        reclevel: Trove.RECLEVEL.FULL,
        includes: [Trove.INCLUDE.TAGS, Trove.INCLUDE.COMMENTS],
        done: picture_done
    });

The done and fail callbacks can be set via the options on construction or on the get() method. If set with the get() method after being set on construction, the new callbacks will be used from there on.

Clone this wiki locally