You're viewing the legacy docs. They are deprecated as of May 18, 2016.
These docs are for version 2.4.2 and below of the Javascript SDK. Go to our current docs, or see our Web migration guide.

Version 2.4.2Changelog

Firebase.setWithPriority()

Write data to a Firebase location, like set(), but also specify the priority for that data. Identical to doing a set() followed by a setPriority(), except it is combined into a single atomic operation to ensure the data is ordered correctly from the start.

var fredRef = new Firebase('https://docs-examples.firebaseio.com/samplechat/users/fred');

var user = {
  name: {
    first: 'Fred',
    last: 'Flintstone'
  },
  rank: 1000
};

fredRef.setWithPriority(user, 1000);
// We've written Fred's name and rank to firebase, and used his rank (1000) as the
// priority of the data so he'll be ordered relative to other users by his rank