We've always been at war with {{dstache}}theEnemy}}.
{{lt}}/template> // in main.js Template.main.helpers({ theEnemy: function () { return Session.get("enemy"); } }); Session.set("enemy", "Eastasia"); // Page will say "We've always been at war with Eastasia" Session.set("enemy", "Eurasia"); // Page will change to say "We've always been at war with Eurasia" {{> autoApiBox "Session.equals"}} If value is a scalar, then these two expressions do the same thing: (1) Session.get("key") === value (2) Session.equals("key", value) ... but the second one is always better. It triggers fewer invalidations (template redraws), making your program more efficient. Example: {{lt}}template name="postsView"> {{dstache}}! Show a dynamically updating list of items. Let the user click on an item to select it. The selected item is given a CSS class so it can be rendered differently. }} {{dstache}}#each posts}} {{dstache}}> postItem }} {{dstache}}/each}} {{lt}}/template> {{lt}}template name="postItem">click"}}
Mouse click on any element, including a link, button, form control, or div.
Use `preventDefault()` to prevent a clicked link from being followed.
Some ways of activating an element from the keyboard also fire `click`.
{{/dtdd}}
{{#dtdd "dblclick"}}
Double-click.
{{/dtdd}}
{{#dtdd "focus, blur"}}
A text input field or other form control gains or loses focus. You
can make any element focusable by giving it a `tabindex` property.
Browsers differ on whether links, checkboxes, and radio buttons are
natively focusable. These events do not bubble.
{{/dtdd}}
{{#dtdd "change"}}
A checkbox or radio button changes state. For text fields, use
`blur` or key events to respond to changes.
{{/dtdd}}
{{#dtdd "mouseenter, mouseleave"}} The pointer enters or
leaves the bounds of an element. These events do not bubble.
{{/dtdd}}
{{#dtdd "mousedown, mouseup"}}
The mouse button is newly down or up.
{{/dtdd}}
{{#dtdd "keydown, keypress, keyup"}}
The user presses a keyboard key. `keypress` is most useful for
catching typing in text fields, while `keydown` and `keyup` can be
used for arrow keys or modifier keys.
{{/dtdd}}
Match.Any"}}
Matches any value.
{{/dtdd}}
{{#dtdd "String, Number, Boolean, undefined, null"}}
Matches a primitive of the given type.
{{/dtdd}}
{{#dtdd "Match.Integer"}}
Matches a signed 32-bit integer. Doesn't match `Infinity`, `-Infinity`, or `NaN`.
{{/dtdd}}
{{#dtdd "[pattern]"}}
A one-element array matches an array of elements, each of which match
*pattern*. For example, `[Number]` matches a (possibly empty) array of numbers;
`[Match.Any]` matches any array.
{{/dtdd}}
{{#dtdd "{key1: pattern1, key2: pattern2, ...}"}}
Matches an Object with the given keys, with values matching the given patterns.
If any *pattern* is a `Match.Optional`, that key does not need to exist
in the object. The value may not contain any keys not listed in the pattern.
The value must be a plain Object with no special prototype.
{{/dtdd}}
{{#dtdd "Match.ObjectIncluding({key1: pattern1, key2: pattern2, ...})"}}
Matches an Object with the given keys; the value may also have other keys
with arbitrary values.
{{/dtdd}}
{{#dtdd "Object"}}
Matches any plain Object with any keys; equivalent to
`Match.ObjectIncluding({})`.
{{/dtdd}}
{{#dtdd "Match.Optional(pattern)"}} Matches either
`undefined` or something that matches pattern. If used in an object this matches
only if the key is not set as opposed to the value being set to `undefined`.
// In an object
var pat = { name: Match.Optional(String) };
check({ name: "something" }, pat) // OK
check({}, pat) // OK
check({ name: undefined }, pat) // Throws an exception
// Outside an object
check(undefined, Match.Optional(String)); // OK
{{/dtdd}}
{{#dtdd "Match.OneOf(pattern1, pattern2, ...)"}}
Matches any value that matches at least one of the provided patterns.
{{/dtdd}}
{{#dtdd "Any constructor function (eg, Date)"}}
Matches any element that is an instance of that type.
{{/dtdd}}
{{#dtdd "Match.Where(condition)"}}
Calls the function *condition* with the value as the argument. If *condition*
returns true, this matches. If *condition* throws a `Match.Error` or returns
false, this fails. If *condition* throws any other error, that error is thrown
from the call to `check` or `Match.test`. Examples:
check(buffer, Match.Where(EJSON.isBinary));
NonEmptyString = Match.Where(function (x) {
check(x, String);
return x.length > 0;
});
check(arg, NonEmptyString);
{{/dtdd}}
null on error.null