开发者

if folder exists, return true

开发者 https://www.devze.com 2023-01-08 23:43 出处:网络
I can check if a folder is empty. this.emptyfolder =开发者_JS百科 function(folderid) { result = PlacesUtils.getFolderContents(folderid);

I can check if a folder is empty.

this.emptyfolder =开发者_JS百科 function(folderid) {
    result = PlacesUtils.getFolderContents(folderid);
    resultContainerNode = result.root;
    if (resultContainerNode.ChildCount == 0) {
        return true;
    } else {
        return false;
    }
}

How to check if a folder exists even if it's empty?

  • link to the PlacesUtils description
  • link to the PlacesUtils code


many bookmarks service methods will throw if and item id does not exist, so for example PlacesUtils.bookmarks.getItemType(itemId); will throw. But actually, I'm missing your use-case, when working with folders you usually work with views, and you the don't bother about the fact a certain item id exists.

0

精彩评论

暂无评论...
验证码 换一张
取 消