有什么方法可以判断当前加载了哪些PouchDB插件?

时间:2017-04-13 01:45:09

标签: plugins pouchdb

标题几乎说明了一切。

有没有办法获得加载的PouchDB插件列表?或者失败了,有没有办法检查是否加载了特定的插件?

1 个答案:

答案 0 :(得分:3)

Pouchdb只是为其原型添加插件,所以如果你不介意看一些内置插件:

> location.href
"http://nolanlawson.github.io/pouchdb-find/"

> Object.getOwnPropertyNames(PouchDB.prototype)
Array[11]
0: "constructor"
1: "query"
2: "viewCleanup"
3: "replicate"
4: "sync"
5: "upsert"
6: "putIfNotExists"
7: "createIndex"
8: "find"
9: "getIndexes"
10: "deleteIndex"
length: 11
__proto__: Array[0]


> "find" in Object.getOwnPropertyNames(PouchDB.prototype)
true