Confirmed users
595
edits
No edit summary |
|||
Line 43: | Line 43: | ||
=== Examples === | === Examples === | ||
'''Get module''' | |||
<pre class="brush:js;toolbar:false;"> | |||
var places = require("places"); | |||
</pre> | |||
'''Get module''' | |||
<pre class="brush:js;toolbar:false;"> | |||
var places = require("places"); | |||
</pre> | |||
'''Filter history''' | |||
<pre class="brush:js;toolbar:false;"> | |||
function callbackFunc(results) { | |||
// results is an array of ResultItem objects. | |||
// a 0-length results indicates there are no more results. | |||
} | |||
// See PlacesQuery for description of the query configuration object. | |||
places.history.filter({ host: "^www.moz" }, callbackFunc, callbackScope); | |||
</pre> | |||
'''Filter bookmarks''' | |||
<pre class="brush:js;toolbar:false;"> | |||
places.history.filter({ phrase: "search words" }, callbackFunc, callbackScope); | |||
</pre> | |||
'''Filter pages''' | |||
<pre class="brush:js;toolbar:false;"> | |||
places.filter({ phrase: "search words" }, callbackFunc, callbackScope); | |||
</pre> | |||
'''Clear history''' | |||
<pre class="brush:js;toolbar:false;"> | |||
places.history.remove(callbackFunc, callbackScope); | |||
</pre> | |||
'''Remove pages from history''' | |||
<pre class="brush:js;toolbar:false;"> | |||
places.history.filter({ host: "remove.host.com" }) | |||
.remove(callbackFunc, callbackScope); | |||
</pre> |