diff --git a/.mailmap b/.mailmap index 550b1158e2..4037c5fbb2 100644 --- a/.mailmap +++ b/.mailmap @@ -10,35 +10,35 @@ GITHUB: aldeed GITHUB: AlexeyMK -GITHUB: apendua -GITHUB: Cangit -GITHUB: DenisGorbachev -GITHUB: EOT -GITHUB: FooBarWidget -GITHUB: Maxhodges -GITHUB: OyoKooN -GITHUB: RobertLowe GITHUB: ansman +GITHUB: apendua GITHUB: awwx GITHUB: babenzele +GITHUB: Cangit GITHUB: cmather GITHUB: codeinthehole +GITHUB: cryptoquick GITHUB: dandv GITHUB: davegonzalez +GITHUB: DenisGorbachev GITHUB: ducdigital GITHUB: duckspeaker GITHUB: emgee3 +GITHUB: EOT GITHUB: felixrabe +GITHUB: FooBarWidget GITHUB: FredericoC +GITHUB: Gaelan GITHUB: icellan GITHUB: ImtiazMajeed GITHUB: jacott -GITHUB: jfhamlin GITHUB: jbruni -GITHUB: justinsb +GITHUB: jfhamlin +GITHUB: jperl GITHUB: kentonv GITHUB: marcandre GITHUB: mart-jansink +GITHUB: Maxhodges GITHUB: MaximDubrovin GITHUB: meawoppl GITHUB: meonkeys @@ -49,14 +49,22 @@ GITHUB: mizzao GITHUB: mquandalle GITHUB: nathan-muir GITHUB: Neftedollar +GITHUB: OyoKooN GITHUB: paulswartz GITHUB: Pent GITHUB: prapicault +GITHUB: prapicault +GITHUB: pscanf GITHUB: queso GITHUB: rcy -GITHUB: RichardLitt GITHUB: rdickert GITHUB: rgould +GITHUB: RichardLitt +GITHUB: richguan +GITHUB: rick-golden-healthagen +GITHUB: rissem +GITHUB: RobertLowe +GITHUB: rosh93 GITHUB: ryw GITHUB: rzymek GITHUB: sdarnell @@ -64,6 +72,7 @@ GITHUB: subhog GITHUB: tbjers GITHUB: thatneat GITHUB: timhaines +GITHUB: timoabend GITHUB: tmeasday GITHUB: twhy GITHUB: waitingkuo @@ -73,8 +82,8 @@ GITHUB: zol METEOR: arbesfeld METEOR: avital -METEOR: ben -METEOR: ben +METEOR: benjamn +METEOR: benjamn METEOR: debergalis METEOR: dgreensp METEOR: ekatek @@ -83,9 +92,11 @@ METEOR: estark37 METEOR: glasser METEOR: glasser METEOR: gschmidt +METEOR: justinsb METEOR: karayu METEOR: mariapacana METEOR: n1mmy METEOR: sixolet METEOR: Slava +METEOR: Slava METEOR: stubailo diff --git a/History.md b/History.md index c4d482e6b8..1e81cc9d0e 100644 --- a/History.md +++ b/History.md @@ -1,26 +1,126 @@ ## v.NEXT +## v0.9.4 + +### New Features + +* The new `meteor debug` command and `--debug-port` command line option + to `meteor run` allow you to easily use node-inspector to debug your + server-side code. Add a `debugger` statement to your code to create a + breakpoint. + +* Add new a `meteor run --test` command that runs + [Velocity](https://github.com/meteor-velocity/velocity) tests in your + app . + +* Add new callbacks `Accounts.onResetPasswordLink`, + `Accounts.onEnrollmentLink`, and `Accounts.onEmailVerificationLink` + that make it easier to build custom user interfaces on top of the + accounts system. These callbacks should be registered before + `Meteor.startup` fires, and will be called if the URL matches a link + in an email sent by `Accounts.resetPassword`, etc. See + https://docs.meteor.com/#Accounts-onResetPasswordLink. + +* A new configuration file for mobile apps, + `/mobile-config.js`. This allows you to set app metadata, icons, + splash screens, preferences, and PhoneGap/Cordova plugin settings + without needing a `cordova_build_override` directory. See + https://docs.meteor.com/#mobileconfigjs. + + +### API Changes + * Rename `{{> UI.dynamic}}` to `{{> Template.dynamic}}`, and likewise - with `UI.contentBlock` and `UI.elseBlock`. + with `UI.contentBlock` and `UI.elseBlock`. The UI namespace is no + longer used anywhere except for backwards compatibility. + +* Deprecate the `Template.someTemplate.myHelper = ...` syntax in favor + of `Template.someTemplate.helpers(...)`. Using the older syntax still + works, but prints a deprecation warning to the console. + +* `Package.registerBuildPlugin` its associated functions have been added + to the public API, cleaned up, and documented. The new function is + identical to the earlier _transitional_registerBuildPlugin except for + minor backwards- compatible API changes. See + https://docs.meteor.com/#Package-registerBuildPlugin + +* Rename the `showdown` package to `markdown`. * Deprecate the `amplify`, `backbone`, `bootstrap`, and `d3` integration packages in favor of community alternatives. These packages will no longer be maintained by MDG. -* Rename the `showdown` package to `markdown`. -* Deprecate the `Template.someTemplate.myHelper = ...` syntax in favor - of `Template.someTemplate.helpers(...)`. Using the older syntax still - works, but it prints a deprecation warning to the console. +### Tool Changes + +* Improved output from `meteor build` to make it easier to publish + mobile apps to the App Store and Play Store. See the wiki pages for + instructions on how to publish your + [iOS](https://github.com/meteor/meteor/wiki/How-to-submit-your-iOS-app-to-App-Store) + and + [Android](https://github.com/meteor/meteor/wiki/How-to-submit-your-Android-app-to-Play-Store) + apps. + +* Packages can now be marked as debug-mode only by adding `debugOnly: + true` to `Package.describe`. Debug-only packages are not included in + the app when it is bundled for production (`meteor build` or `meteor + run --production`). This allows package authors to build packages + specifically for testing and debugging without increasing the size of + the resulting app bundle or causing apps to ship with debug + functionality built in. + +* Rework the process for installing mobile development SDKs. There is + now a `meteor install-sdk` command that automatically install what + software it can and points to documentation for the parts that + require manual installation. + +* The `.meteor/cordova-platforms` file has been renamed to + `.meteor/platforms` and now includes the default `server` and + `browser` platforms. The default platforms can't currently be removed + from a project, though this will be possible in the future. The old + file will be automatically migrated to the new one when the app is run + with Meteor 0.9.4 or above. + +* The `unipackage.json` file inside downloaded packages has been renamed + to `isopack.json` and has an improved forwards-compatible format. To + maintain backwards compatibility with previous releases, packages will + be built with both files. + +* The local package metadata cache now uses SQLite, which is much faster + than the previous implementation. This improves `meteor` command line + tool startup time. + +* The constraint solver used by the client to find compatible versions + of packages is now much faster. + +* The `--port` option to `meteor run` now requires a numeric port + (e.g. `meteor run --port example.com` is no longer valid). + +* The `--mobile-port` option `meteor run` has been reworked. The option + is now `--mobile-server` in `meteor run` and `--server` in `meteor + build`. `--server` is required for `meteor build` in apps with mobile + platforms installed. `--mobile-server` defaults to an automatically + detected IP address on port 3000, and `--server` requires a hostname + but defaults to port 80 if a port is not specified. + +* Operations that take longer than a few seconds (e.g. downloading + packages, installing the Android SDK, etc) now show a progress bar. + + +### Bug Fixes * Fix behavior of ROOT_URL with path ending in `/`. * Fix source maps when using a ROOT_URL with a path. #2627 -* --port now requires a port (e.g. `meteor run --port example.com` is - not valid). XXX --mobile-port deprecated in favor of --mobile-server - option for 'meteor run' and '--server' for 'meteor build'. --server - is required for meteor build. describe defaults for --mobile-server. +* Change the mechanism that the Meteor tool uses to clean up app server + processes. The new mechanism is more resilient to slow app bundles and + other CPU-intensive tasks. #2536, #2588. + + +Patches by Github users cryptoquick, Gaelan, jperl, meonkeys, mitar, +mquandalle, prapicault, pscanf, richguan, rick-golden-healthagen, +rissem, rosh93, rzymek, and timoabend ## v0.9.3.1 @@ -29,8 +129,6 @@ * Allow more than one dash in package versions. #2715 -* Fix `meteor update` on an app built from a checkout version - of Meteor. ## v0.9.3 diff --git a/LICENSE.txt b/LICENSE.txt index 710525efa1..bed271a30b 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -884,6 +884,7 @@ Modifications made by the following entities are licensed as above: accepts: https://github.com/jshttp/accepts merge-descriptors: https://github.com/component/merge-descriptors type-is: https://github.com/jshttp/type-is +mime-types: https://github.com/jshttp/mime-types ---------- Copyright (c) 2013 Jonathan Ong me@jongleberry.com @@ -947,6 +948,35 @@ utils-merge: https://github.com/jaredhanson/utils-merge Copyright (c) 2013 Jared Hanson +---------- +bl: https://github.com/rvagg/bl +---------- + +Copyright (c) 2014 bl contributors +bl contributors listed at https://github.com/rvagg/bl#contributors + + +---------- +lodash-node: https://github.com/lodash/lodash-node +---------- + +Copyright 2012-2014 The Dojo Foundation +Based on Underscore.js 1.6.0, copyright 2009-2014 Jeremy Ashkenas, +DocumentCloud and Investigative Reporters & Editors + + +---------- +netroute: https://github.com/indutny/node-netroute +---------- + +Copyright Fedor Indutny, 2012. + + +---------- +stringstream: https://github.com/mhart/StringStream +---------- + +Copyright 2012 Michael Hart (michael.hart.au@gmail.com) ============== @@ -1229,6 +1259,99 @@ Copyright (C) 2013 David Nolen and contributors BSD Licenses ============ +---------- +tar-pack: https://github.com/ForbesLindesay/tar-pack +---------- + +Copyright (c) 2014, Forbes Lindesay +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +---------- +sqlite3: https://github.com/mapbox/node-sqlite3 +---------- + +Copyright (c) MapBox +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. +- Neither the name "MapBox" nor the names of its contributors may be + used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +---------- +node-pre-gyp: https://github.com/mapbox/node-pre-gyp +---------- + +Copyright (c), Mapbox + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of node-pre-gyp nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + ---------- uglify-js: https://github.com/mishoo/UglifyJS2 ---------- diff --git a/docs/.meteor/.finished-upgraders b/docs/.meteor/.finished-upgraders index ee0ed5a316..68df3d8d0d 100644 --- a/docs/.meteor/.finished-upgraders +++ b/docs/.meteor/.finished-upgraders @@ -4,3 +4,4 @@ notices-for-0.9.0 notices-for-0.9.1 +0.9.4-platform-file diff --git a/docs/.meteor/packages b/docs/.meteor/packages index 3273520f32..1c34756d56 100644 --- a/docs/.meteor/packages +++ b/docs/.meteor/packages @@ -7,9 +7,11 @@ standard-app-packages jquery underscore showdown -code-prettify jquery-waypoints less spiderable appcache reload-safetybelt +simple:markdown-templating +simple:highlight.js + diff --git a/docs/.meteor/platforms b/docs/.meteor/platforms new file mode 100644 index 0000000000..efeba1b50c --- /dev/null +++ b/docs/.meteor/platforms @@ -0,0 +1,2 @@ +server +browser diff --git a/docs/.meteor/release b/docs/.meteor/release index 01887b6a68..7057f80807 100644 --- a/docs/.meteor/release +++ b/docs/.meteor/release @@ -1 +1 @@ -METEOR@0.9.3.1 +METEOR@0.9.4 diff --git a/docs/.meteor/versions b/docs/.meteor/versions index ce3da053a0..3a4a2eb300 100644 --- a/docs/.meteor/versions +++ b/docs/.meteor/versions @@ -1,58 +1,60 @@ -appcache@1.0.1 -application-configuration@1.0.2 -autoupdate@1.1.1 -base64@1.0.0 -binary-heap@1.0.0 -blaze-tools@1.0.0 -blaze@2.0.1 -boilerplate-generator@1.0.0 -callback-hook@1.0.0 -check@1.0.1 -code-prettify@1.0.0 -coffeescript@1.0.3 -ctl-helper@1.0.3 -ctl@1.0.1 -ddp@1.0.9 -deps@1.0.4 -ejson@1.0.3 -fastclick@1.0.0 -follower-livedata@1.0.1 -geojson-utils@1.0.0 -html-tools@1.0.1 -htmljs@1.0.1 -http@1.0.6 -id-map@1.0.0 -jquery-waypoints@1.0.0 -jquery@1.0.0 -json@1.0.0 -less@1.0.9 -livedata@1.0.10 -logging@1.0.3 -meteor-platform@1.1.1 -meteor@1.1.1 -minifiers@1.1.0 -minimongo@1.0.3 -mobile-status-bar@1.0.0 -mongo@1.0.6 -observe-sequence@1.0.2 -ordered-dict@1.0.0 -random@1.0.0 -reactive-dict@1.0.3 -reactive-var@1.0.2 -reload-safetybelt@1.0.0 -reload@1.1.0 -retry@1.0.0 -routepolicy@1.0.1 -session@1.0.2 -showdown@1.0.1 -spacebars-compiler@1.0.2 -spacebars@1.0.2 -spiderable@1.0.3 -standard-app-packages@1.0.2 -templating@1.0.7 -tracker@1.0.2 -ui@1.0.3 -underscore@1.0.0 -url@1.0.0 -webapp-hashing@1.0.0 -webapp@1.1.2 +appcache@1.0.2 +application-configuration@1.0.3 +autoupdate@1.1.2 +base64@1.0.1 +binary-heap@1.0.1 +blaze-tools@1.0.1 +blaze@2.0.2 +boilerplate-generator@1.0.1 +callback-hook@1.0.1 +check@1.0.2 +coffeescript@1.0.4 +ctl-helper@1.0.4 +ctl@1.0.2 +ddp@1.0.10 +deps@1.0.5 +ejson@1.0.4 +fastclick@1.0.1 +follower-livedata@1.0.2 +geojson-utils@1.0.1 +html-tools@1.0.2 +htmljs@1.0.2 +http@1.0.7 +id-map@1.0.1 +jquery-waypoints@1.0.1 +jquery@1.0.1 +json@1.0.1 +less@1.0.10 +livedata@1.0.11 +logging@1.0.4 +markdown@1.0.2 +meteor-platform@1.1.2 +meteor@1.1.2 +minifiers@1.1.1 +minimongo@1.0.4 +mobile-status-bar@1.0.1 +mongo@1.0.7 +observe-sequence@1.0.3 +ordered-dict@1.0.1 +random@1.0.1 +reactive-dict@1.0.4 +reactive-var@1.0.3 +reload-safetybelt@1.0.1 +reload@1.1.1 +retry@1.0.1 +routepolicy@1.0.2 +session@1.0.3 +showdown@1.0.2 +simple:highlight.js@1.0.1 +simple:markdown-templating@1.2.5 +spacebars-compiler@1.0.3 +spacebars@1.0.3 +spiderable@1.0.4 +standard-app-packages@1.0.3 +templating@1.0.8 +tracker@1.0.3 +ui@1.0.4 +underscore@1.0.1 +url@1.0.1 +webapp-hashing@1.0.1 +webapp@1.1.3 diff --git a/docs/client/api.html b/docs/client/api.html deleted file mode 100644 index 8df1929e4e..0000000000 --- a/docs/client/api.html +++ /dev/null @@ -1,3669 +0,0 @@ - diff --git a/docs/client/api.md b/docs/client/api.md new file mode 100644 index 0000000000..6ede3b94b8 --- /dev/null +++ b/docs/client/api.md @@ -0,0 +1,31 @@ +{{#template name="api"}} + +

The Meteor API

+ +Your JavaScript code can run in two environments: the *client* (browser), and +the *server* (a [Node.js](http://nodejs.org/) container on a server). For each +function in this API reference, we'll indicate if the function is available just +on the client, just on the server, or *Anywhere*. + +{{> api_core}} +{{> api_pubsub}} +{{> api_methods}} +{{> api_check}} +{{> api_connections}} +{{> api_collections}} +{{> api_session}} +{{> api_accounts}} +{{> api_passwords}} +{{> api_templates}} +{{> api_blaze}} +{{> api_timers}} +{{> api_tracker}} +{{> api_reactive_var}} +{{> api_ejson}} +{{> api_http}} +{{> api_email}} +{{> api_assets}} +{{> api_packagejs}} +{{> api_mobile_config}} + +{{/template}} diff --git a/docs/client/api/accounts.md b/docs/client/api/accounts.md new file mode 100644 index 0000000000..a0b16aac1a --- /dev/null +++ b/docs/client/api/accounts.md @@ -0,0 +1,384 @@ +{{#template name="api_accounts"}} + +

Accounts

+ +The Meteor Accounts system builds on top of the `userId` support in +[`publish`](#publish_userId) and [`methods`](#method_userId). The core +packages add the concept of user documents stored in the database, and +additional packages add [secure password +authentication](#accounts_passwords), [integration with third party +login services](#meteor_loginwithexternalservice), and a [pre-built user +interface](#accountsui). + +The basic Accounts system is in the `accounts-base` package, but +applications typically include this automatically by adding one of the +login provider packages: `accounts-password`, `accounts-facebook`, +`accounts-github`, `accounts-google`, `accounts-meetup`, +`accounts-twitter`, or `accounts-weibo`. + + +{{> autoApiBox "Meteor.user"}} + +Retrieves the user record for the current user from +the [`Meteor.users`](#meteor_users) collection. + +On the client, this will be the subset of the fields in the document that +are published from the server (other fields won't be available on the +client). By default the server publishes `username`, `emails`, and +`profile`. See [`Meteor.users`](#meteor_users) for more on +the fields used in user documents. + +{{> autoApiBox "Meteor.userId"}} + +{{> autoApiBox "Meteor.users"}} + +This collection contains one document per registered user. Here's an example +user document: + + { + _id: "bbca5d6a-2156-41c4-89da-0329e8c99a4f", // Meteor.userId() + username: "cool_kid_13", // unique name + emails: [ + // each email address can only belong to one user. + { address: "cool@example.com", verified: true }, + { address: "another@different.com", verified: false } + ], + createdAt: Wed Aug 21 2013 15:16:52 GMT-0700 (PDT), + profile: { + // The profile is writable by the user by default. + name: "Joe Schmoe" + }, + services: { + facebook: { + id: "709050", // facebook id + accessToken: "AAACCgdX7G2...AbV9AZDZD" + }, + resume: { + loginTokens: [ + { token: "97e8c205-c7e4-47c9-9bea-8e2ccc0694cd", + when: 1349761684048 } + ] + } + } + } + +A user document can contain any data you want to store about a user. Meteor +treats the following fields specially: + +- `username`: a unique String identifying the user. +- `emails`: an Array of Objects with keys `address` and `verified`; + an email address may belong to at most one user. `verified` is + a Boolean which is true if the user has [verified the + address](#accounts_verifyemail) with a token sent over email. +- `createdAt`: the Date at which the user document was created. +- `profile`: an Object which (by default) the user can create + and update with any data. +- `services`: an Object containing data used by particular + login services. For example, its `reset` field contains + tokens used by [forgot password](#accounts_forgotpassword) links, + and its `resume` field contains tokens used to keep you + logged in between sessions. + +Like all [Mongo.Collection](#collections)s, you can access all +documents on the server, but only those specifically published by the server are +available on the client. + +By default, the current user's `username`, `emails` and `profile` are +published to the client. You can publish additional fields for the +current user with: + + // server + Meteor.publish("userData", function () { + if (this.userId) { + return Meteor.users.find({_id: this.userId}, + {fields: {'other': 1, 'things': 1}}); + } else { + this.ready(); + } + }); + + // client + Meteor.subscribe("userData"); + +If the autopublish package is installed, information about all users +on the system is published to all clients. This includes `username`, +`profile`, and any fields in `services` that are meant to be public +(eg `services.facebook.id`, +`services.twitter.screenName`). Additionally, when using autopublish +more information is published for the currently logged in user, +including access tokens. This allows making API calls directly from +the client for services that allow this. + +Users are by default allowed to specify their own `profile` field with +[`Accounts.createUser`](#accounts_createuser) and modify it with +`Meteor.users.update`. To allow users to edit additional fields, use +[`Meteor.users.allow`](#allow). To forbid users from making any modifications to +their user document: + + Meteor.users.deny({update: function () { return true; }}); + + +{{> autoApiBox "Meteor.loggingIn"}} + +For example, [the `accounts-ui` package](#accountsui) uses this to display an +animation while the login request is being processed. + +{{> autoApiBox "Meteor.logout"}} + +{{> autoApiBox "Meteor.logoutOtherClients"}} + +For example, when called in a user's browser, connections in that browser +remain logged in, but any other browsers or DDP clients logged in as that user +will be logged out. + +{{> autoApiBox "Meteor.loginWithPassword"}} + +This function is provided by the `accounts-password` package. See the +[Passwords](#accounts_passwords) section below. + + +{{> autoApiBox "Meteor.loginWith"}} + +Available functions are: + +* `Meteor.loginWithMeteorDeveloperAccount` +* `Meteor.loginWithFacebook` +* `Meteor.loginWithGithub` +* `Meteor.loginWithGoogle` +* `Meteor.loginWithMeetup` +* `Meteor.loginWithTwitter` +* `Meteor.loginWithWeibo` + +These functions initiate the login process with an external +service (eg: Facebook, Google, etc), using OAuth. When called they open a new pop-up +window that loads the provider's login page. Once the user has logged in +with the provider, the pop-up window is closed and the Meteor client +logs in to the Meteor server with the information provided by the external +service. + + + +In addition to identifying the user to your application, some services +have APIs that allow you to take action on behalf of the user. To +request specific permissions from the user, pass the +`requestPermissions` option the login function. This will cause the user +to be presented with an additional page in the pop-up dialog to permit +access to their data. The user's `accessToken` — with permissions +to access the service's API — is stored in the `services` field of +the user document. The supported values for `requestPermissions` differ +for each login service and are documented on their respective developer +sites: + +- Facebook: +- GitHub: +- Google: +- Meetup: +- Twitter, Weibo, Meteor developer accounts: `requestPermissions` currently not supported + +External login services typically require registering and configuring +your application before use. The easiest way to do this is with the +[`accounts-ui` package](#accountsui) which presents a step-by-step guide +to configuring each service. However, the data can be also be entered +manually in the `ServiceConfiguration.configurations` collection, which +is exported by the `service-configuration` package. For example, after +running `meteor add service-configuration` in your app: + + // first, remove configuration entry in case service is already configured + ServiceConfiguration.configurations.remove({ + service: "weibo" + }); + ServiceConfiguration.configurations.insert({ + service: "weibo", + clientId: "1292962797", + loginStyle: "popup", + secret: "75a730b58f5691de5522789070c319bc" + }); + + +Each external service has its own login provider package and login function. For +example, to support GitHub login, run `$ meteor add accounts-github` and use the +`Meteor.loginWithGithub` function: + + Meteor.loginWithGithub({ + requestPermissions: ['user', 'public_repo'] + }, function (err) { + if (err) + Session.set('errorMessage', err.reason || 'Unknown error'); + }); + +Login service configuration is sent from the server to the client over DDP when +your app starts up; you may not call the login function until the configuration +is loaded. The function `Accounts.loginServicesConfigured()` is a reactive data +source that will return true once the login service is configured; you should +not make login buttons visible or active until it is true. + +{{> autoApiBox "currentUser"}} + +{{> autoApiBox "loggingIn"}} + +{{> autoApiBox "Accounts.config"}} +{{> autoApiBox "Accounts.ui.config"}} + +Example: + + Accounts.ui.config({ + requestPermissions: { + facebook: ['user_likes'], + github: ['user', 'repo'] + }, + requestOfflineToken: { + google: true + }, + passwordSignupFields: 'USERNAME_AND_OPTIONAL_EMAIL' + }); + +{{> autoApiBox "Accounts.validateNewUser"}} + +This can be called multiple times. If any of the functions return `false` or +throw an error, the new user creation is aborted. To set a specific error +message (which will be displayed by [`accounts-ui`](#accountsui)), throw a new +[`Meteor.Error`](#meteor_error). + +Example: + + // Validate username, sending a specific error message on failure. + Accounts.validateNewUser(function (user) { + if (user.username && user.username.length >= 3) + return true; + throw new Meteor.Error(403, "Username must have at least 3 characters"); + }); + // Validate username, without a specific error message. + Accounts.validateNewUser(function (user) { + return user.username !== "root"; + }); + +If the user is being created as part of a login attempt from a client (eg, +calling [`Accounts.createUser`](#accounts_createuser) from the client, or +[logging in for the first time with an external +service](#meteor_loginwithexternalservice)), these callbacks are called *before* +the [`Accounts.validateLoginAttempt`](#accounts_validateloginattempt) +callbacks. If these callbacks succeed but those fail, the user will still be +created but the connection will not be logged in as that user. + +{{> autoApiBox "Accounts.onCreateUser"}} + +Use this when you need to do more than simply accept or reject new user +creation. With this function you can programatically control the +contents of new user documents. + +The function you pass will be called with two arguments: `options` and +`user`. The `options` argument comes +from [`Accounts.createUser`](#accounts_createuser) for +password-based users or from an external service login flow. `options` may come +from an untrusted client so make sure to validate any values you read from +it. The `user` argument is created on the server and contains a +proposed user object with all the automatically generated fields +required for the user to log in. + +The function should return the user document (either the one passed in or a +newly-created object) with whatever modifications are desired. The returned +document is inserted directly into the [`Meteor.users`](#meteor_users) collection. + +The default create user function simply copies `options.profile` into +the new user document. Calling `onCreateUser` overrides the default +hook. This can only be called once. + +Example: + + + + // Support for playing D&D: Roll 3d6 for dexterity + Accounts.onCreateUser(function(options, user) { + var d6 = function () { return Math.floor(Random.fraction() * 6) + 1; }; + user.dexterity = d6() + d6() + d6(); + // We still want the default hook's 'profile' behavior. + if (options.profile) + user.profile = options.profile; + return user; + }); + + +{{> autoApiBox "Accounts.validateLoginAttempt"}} + +Call `validateLoginAttempt` with a callback to be called on login +attempts. It returns an object with a single method, `stop`. Calling +`stop()` unregisters the callback. + +When a login attempt is made, the registered validate login callbacks +are called with a single argument, the attempt info object: + +
+{{#dtdd name="type" type="String"}} + The service name, such as "password" or "twitter". +{{/dtdd}} + +{{#dtdd name="allowed" type="Boolean"}} + Whether this login is allowed and will be successful (if not aborted + by any of the validateLoginAttempt callbacks). False if the login + will not succeed (for example, an invalid password or the login was + aborted by a previous validateLoginAttempt callback). +{{/dtdd}} + +{{#dtdd name="error" type="Exception"}} + When `allowed` is false, the exception describing why the login + failed. It will be a `Meteor.Error` for failures reported to the + user (such as invalid password), and can be a another kind of + exception for internal errors. +{{/dtdd}} + +{{#dtdd name="user" type="Object"}} + When it is known which user was attempting to login, the Meteor user + object. This will always be present for successful logins. +{{/dtdd}} + +{{#dtdd name="connection" type="Object"}} + The `connection` object the request came in on. See + [`Meteor.onConnection`](#meteor_onconnection) for details. +{{/dtdd}} + +{{#dtdd name="methodName" type="String"}} + The name of the Meteor method being used to login. +{{/dtdd}} + +{{#dtdd name="methodArguments" type="Array"}} + An array of the arguments passed to the login method. +{{/dtdd}} +
+ +A validate login callback must return a truthy value for the login to +proceed. If the callback returns a falsy value or throws an +exception, the login is aborted. Throwing a `Meteor.Error` will +report the error reason to the user. + +All registered validate login callbacks are called, even if one of the callbacks +aborts the login. The later callbacks will see the `allowed` field set to +`false` since the login will now not be successful. This allows later callbacks +to override an error from a previous callback; for example, you could override +the "Incorrect password" error with a different message. + +Validate login callbacks that aren't explicitly trying to override a previous +error generally have no need to run if the attempt has already been determined +to fail, and should start with + + if (!attempt.allowed) + return false; + + +{{> autoApiBox "Accounts.onLogin"}} + +See description of [Accounts.onLoginFailure](#accounts_onloginfailure) +for details. + +{{> autoApiBox "Accounts.onLoginFailure"}} + +Either the `onLogin` or the `onLoginFailure` callbacks will be called +for each login attempt. The `onLogin` callbacks are called after the +user has been successfully logged in. The `onLoginFailure` callbacks are +called after a login attempt is denied. + +These functions return an object with a single method, `stop`. Calling +`stop()` unregisters the callback. + +The callbacks are called with a single argument, the same attempt info +object as [`validateLoginAttempt`](#accounts_validateloginattempt). +{{/template}} \ No newline at end of file diff --git a/docs/client/api/assets.md b/docs/client/api/assets.md new file mode 100644 index 0000000000..759f25a889 --- /dev/null +++ b/docs/client/api/assets.md @@ -0,0 +1,20 @@ +{{#template name="api_assets"}} + +

Assets

+ +`Assets` allows server code in a Meteor application to access static server +assets, which are located in the `private` subdirectory of an application's +tree. Assets are not processed as source files and are copied directly +into your application's bundle. + +{{> autoApiBox "Assets.getText"}} +{{> autoApiBox "Assets.getBinary"}} + +Static server assets are included by placing them in the application's `private` +subdirectory. For example, if an application's `private` subdirectory includes a +directory called `nested` with a file called `data.txt` inside it, then server +code can read `data.txt` by running: + + var data = Assets.getText('nested/data.txt'); + +{{/template}} \ No newline at end of file diff --git a/docs/client/api/blaze.md b/docs/client/api/blaze.md new file mode 100644 index 0000000000..d2dff4f575 --- /dev/null +++ b/docs/client/api/blaze.md @@ -0,0 +1,307 @@ +{{#template name="api_blaze"}} + +

Blaze

+ +Blaze is the package that makes reactive templates possible. +You can use the Blaze API directly in order to render templates programmatically +and manipulate "Views," the building blocks of reactive templates. + +{{> autoApiBox "Blaze.render"}} + +When you render a template, the +template's [`created`](#template_created) callback is invoked +immediately, before evaluating the content of the template. +The [`rendered`](#template_rendered) callback is +invoked after the View is rendered and inserted into the DOM. + +The rendered template +will update reactively in response to data changes until the View is +removed using [`Blaze.remove`](#blaze_remove) or the View's +parent element is removed by Meteor or jQuery. + +{{#warning}} +If the View is removed by some other mechanism +besides Meteor or jQuery (which Meteor integrates with by default), +the View may continue to update indefinitely. Most users will not need to +manually render templates and insert them into the DOM, but if you do, +be mindful to always call [`Blaze.remove`](#blaze_remove) when the View is +no longer needed. +{{/warning}} + +{{> autoApiBox "Blaze.renderWithData"}} + +`Blaze.renderWithData(Template.myTemplate, data)` is essentially the same as +`Blaze.render(Blaze.With(data, function () { return Template.myTemplate; }))`. + +{{> autoApiBox "Blaze.remove"}} + +Use `Blaze.remove` to remove a template or View previously inserted with +`Blaze.render`, in such a way that any behaviors attached to the DOM by +Meteor are cleaned up. The rendered template or View is now considered +["destroyed"](#template_destroyed), along with all nested templates and +Views. In addition, any data assigned via +jQuery to the DOM nodes is removed, as if the nodes were passed to +jQuery's `$(...).remove()`. + +As mentioned in [`Blaze.render`](#blaze_render), it is important to "remove" +all content rendered via `Blaze.render` using `Blaze.remove`, unless the +parent node of `renderedView` is removed by a Meteor reactive +update or with jQuery. + +`Blaze.remove` can be used even if the DOM nodes in question have already +been removed from the document, to tell Blaze to stop tracking and +updating these nodes. + +{{> autoApiBox "Blaze.getData"}} + +{{> autoApiBox "Blaze.toHTML"}} + +Rendering a template to HTML loses all fine-grained reactivity. The +normal way to render a template is to either include it from another +template (`{{dstache}}> myTemplate}}`) or render and insert it +programmatically using `Blaze.render`. Only occasionally +is generating HTML useful. + +Because `Blaze.toHTML` returns a string, it is not able to update the DOM +in response to reactive data changes. Instead, any reactive data +changes will invalidate the current Computation if there is one +(for example, an autorun that is the caller of `Blaze.toHTML`). + +{{> autoApiBox "Blaze.toHTMLWithData"}} + +{{> autoApiBox "Blaze.View"}} + +Behind every template or part of a template — a template tag, say, like `{{dstache}}foo}}` or `{{dstache}}#if}}` — is +a View object, which is a reactively updating region of DOM. + +Most applications do not need to be aware of these Views, but they offer a +way to understand and customize Meteor's rendering behavior for more +advanced applications and packages. + +You can obtain a View object by calling [`Blaze.render`](#blaze_render) on a +template, or by accessing [`template.view`](#template_view) on a template +instance. + +At the heart of a View is an [autorun](#tracker_autorun) that calls the View's +`renderFunction`, uses the result to create DOM nodes, and replaces the +contents of the View with these new DOM nodes. A View's content may consist +of any number of consecutive DOM nodes (though if it is zero, a placeholder +node such as a comment or an empty text node is automatically supplied). Any +reactive dependency established by `renderFunction` causes a full recalculation +of the View's contents when the dependency is invalidated. Templates, however, +are compiled in such a way that they do not have top-level dependencies and so +will only ever render once, while their parts may re-render many times. + +When a `Blaze.View` is constructed by calling the constructor, no hooks +are fired and no rendering is performed. In particular, the View is +not yet considered to be "created." Only when the View is actually +used, by a call to `Blaze.render` or `Blaze.toHTML` or by inclusion in +another View, is it "created," right before it is rendered for the +first time. When a View is created, its `.parentView` is set if +appropriate, and then the `onViewCreated` hook is fired. The term +"unrendered View" means a newly constructed View that has not been +"created" or rendered. + +The "current View" is kept in [`Blaze.currentView`](#blaze_currentview) and +is set during View rendering, callbacks, autoruns, and template event +handlers. It affects calls such as [`Template.currentData()`](#template_currentdata). + +The following properties and methods are available on Blaze.View: + +
+{{#dtdd name="name" type="String" id="view_name"}} + The name of this type of View. View names may be used to identify +particular kinds of Views in code, but more often they simply aid in +debugging and comprehensibility of the View tree. Views generated +by Meteor have names like "Template.foo" and "if". +{{/dtdd}} + +{{#dtdd name="parentView" type="View or null" id="view_parentview"}} + The enclosing View that caused this View to be rendered, if any. +{{/dtdd}} + +{{#dtdd name="isCreated" type="Boolean" id="view_iscreated"}} + True if this View has been called on to be rendered by `Blaze.render` + or `Blaze.toHTML` or another View. Once it becomes true, never + becomes false again. A "created" View's `.parentView` has been + set to its final value. `isCreated` is set to true before + `onViewCreated` hooks are called. +{{/dtdd}} + +{{#dtdd name="isRendered" type="Boolean" id="view_isrendered"}} + True if this View has been rendered to DOM by `Blaze.render` or + by the rendering of an enclosing View. Conversion to HTML by + `Blaze.toHTML` doesn't count. Once true, never becomes false. +{{/dtdd}} + +{{#dtdd name="isDestroyed" type="Boolean" id="view_isdestroyed"}} + True if this View has been destroyed, such as by `Blaze.remove()` or + by a reactive update that removes it. A destroyed View's autoruns + have been stopped, and its DOM nodes have generally been cleaned + of all Meteor reactivity and possibly dismantled. +{{/dtdd}} + +{{#dtdd name="renderCount" type="Integer" id="view_rendercount"}} + The number of times the View has been rendered, including the + current time is the View is in the process of being rendered + or re-rendered. +{{/dtdd}} + +{{#dtdd name="autorun(runFunc)" id="view_autorun"}} + Like [`Tracker.autorun`](#tracker_autorun), except that the autorun is + automatically stopped when the View is destroyed, and the + [current View](#blaze_currentview) is always set when running `runFunc`. + There is no relationship to the View's internal autorun or render + cycle. In `runFunc`, the View is bound to `this`. +{{/dtdd}} + +{{#dtdd name="onViewCreated(func)" id="view_onviewcreated"}} + If the View hasn't been created yet, calls `func` when the View + is created. In `func`, the View is bound to `this`. + + This hook is the basis for the [`created`](#template_created) + template callback. +{{/dtdd}} + +{{#dtdd name="onViewReady(func)" id="view_onviewready"}} + Calls `func` when the View is rendered and inserted into the DOM, + after waiting for the end of + [flush time](#tracker_afterflush). Does not fire if the View + is destroyed at any point before it would fire. + May fire multiple times (if the View re-renders). + In `func`, the View is bound to `this`. + + This hook is the basis for the [`rendered`](#template_rendered) + template callback. +{{/dtdd}} + +{{#dtdd name="onViewDestroyed(func)" id="view_onviewdestroyed"}} + If the View hasn't been destroyed yet, calls `func` when the + View is destroyed. A View may be destroyed without ever becoming + "ready." In `func`, the View is bound to `this`. + + This hook is the basis for the [`destroyed`](#template_destroyed) + template callback. +{{/dtdd}} + +{{#dtdd name="firstNode()" type="DOM node" id="view_firstnode"}} +The first node of the View's rendered content. Note that this may +be a text node. Requires that the View be rendered. +If the View rendered to zero DOM nodes, it may be a placeholder +node (comment or text node). The DOM extent of a View consists +of the nodes between `view.firstNode()` and `view.lastNode()`, +inclusive. +{{/dtdd}} + +{{#dtdd name="lastNode()" type="DOM node" id="view_lastnode"}} +The last node of the View's rendered content. + +See [`firstNode()`](#view_firstnode). +{{/dtdd}} + +{{#dtdd name="template" type="Template" id="view_template"}} +For Views created by invoking templates, the original Template +object. For example, `Blaze.render(Template.foo).template === Template.foo`. +{{/dtdd}} + +{{#dtdd name="templateInstance()" type="Template instance" +id="view_templateinstance"}} For Views created by invoking templates, +returns the [template instance](#template_inst) object for this +particular View. For example, in a [`created`](#template_created) +callback, `this.view.templateInstance() === this`. + +Template instance objects have fields like `data`, `firstNode`, and +`lastNode` which are not reactive and which are also not automatically +kept up to date. Calling `templateInstance()` causes these fields to +be updated. + +{{/dtdd}} + +
+ +{{> autoApiBox "Blaze.currentView"}} + +The "current view" is used by [`Template.currentData()`](#template_currentdata) and +[`Template.instance()`](#template_instance) to determine +the contextually relevant data context and template instance. + +{{> autoApiBox "Blaze.getView"}} + +If you don't specify an `element`, there must be a current View or an +error will be thrown. This is in contrast to +[`Blaze.currentView`](#blaze_currentview). + +{{> autoApiBox "Blaze.With"}} + +Returns an unrendered View object you can pass to `Blaze.render`. + +Unlike `{{dstache}}#with}}` (as used in templates), `Blaze.With` has no "else" case, and +a falsy value for the data context will not prevent the content from +rendering. + +{{> autoApiBox "Blaze.If"}} + +Returns an unrendered View object you can pass to `Blaze.render`. + +Matches the behavior of `{{dstache}}#if}}` in templates. + +{{> autoApiBox "Blaze.Unless"}} + +Returns an unrendered View object you can pass to `Blaze.render`. + +Matches the behavior of `{{dstache}}#unless}}` in templates. + +{{> autoApiBox "Blaze.Each"}} + +Returns an unrendered View object you can pass to `Blaze.render`. + +Matches the behavior of `{{dstache}}#each}}` in templates. + +{{> autoApiBox "Blaze.Template"}} + +Templates defined by the template compiler, such as `Template.myTemplate`, +are objects of type `Blaze.Template` (aliased as `Template`). + +In addition to methods like `events` and `helpers`, documented as part of +the [Template API](#templates_api), the following fields and methods are +present on template objects: + +
+ +{{#dtdd name="viewName" type="String" id="template_viewname"}} + Same as the constructor argument. +{{/dtdd}} + +{{#dtdd name="renderFunction" type="Function" id="template_renderfunction"}} + Same as the constructor argument. +{{/dtdd}} + +{{#dtdd name="constructView()" id="template_constructview"}} + Constructs and returns an unrendered View object. This method is invoked + by Meteor whenever the template is used, such as by `Blaze.render` or by + `{{dstache}}> foo}}` where `foo` resolves to a Template object. + + `constructView()` constructs a View using `viewName` and `renderFunction` + as constructor arguments, and then configures it as a template + View, setting up `view.template`, `view.templateInstance()`, event maps, and so on. +{{/dtdd}} + +
+ +{{> autoApiBox "Blaze.isTemplate"}} + +{{> apiBoxTitle name="Renderable Content" id="renderable_content"}} + +A value is *renderable content* if it is one of the following: + +* A [template object](#templates_api) like `Template.myTemplate` +* An unrendered [View](#blaze_view) object, like the return value of `Blaze.With` +* `null` or `undefined` + +{{#note}} +Internally, renderable content includes objects representing HTML tags +as well, but these objects are not yet part of the officially-supported, +public API. +{{/note}} + +{{/template}} \ No newline at end of file diff --git a/docs/client/api/check.md b/docs/client/api/check.md new file mode 100644 index 0000000000..48cac568d8 --- /dev/null +++ b/docs/client/api/check.md @@ -0,0 +1,138 @@ +{{#template name="api_check"}} + +

Check

+ +The `check` package includes pattern checking functions useful for checking +the types and structure of variables and an [extensible +library of patterns](#matchpatterns) to specify which types you are expecting. + +{{> autoApiBox "check"}} + +Meteor methods and publish functions take arbitrary [EJSON](#ejson) types as +arguments, but most arguments are expected to be of a particular type. `check` +is a lightweight function for checking that arguments and other +values are of the expected type. For example: + + Meteor.publish("chats-in-room", function (roomId) { + // Make sure roomId is a string, not an arbitrary mongo selector object. + check(roomId, String); + return Chats.find({room: roomId}); + }); + + Meteor.methods({addChat: function (roomId, message) { + check(roomId, String); + check(message, { + text: String, + timestamp: Date, + // Optional, but if present must be an array of strings. + tags: Match.Optional([String]) + }); + + // ... do something with the message ... + }}); + +If the match fails, `check` throws a `Match.Error` describing how it failed. If +this error gets sent over the wire to the client, it will appear only as +`Meteor.Error(400, "Match Failed")`. The failure details will be written to the +server logs but not revealed to the client. + +{{> autoApiBox "Match.test"}} + +`Match.test` can be used to identify if a variable has a certain structure. + +```js +// will return true for {foo: 1, bar: "hello"} or similar +Match.test(value, {foo: Match.Integer, bar: String}); + +// will return true if value is a string +Match.test(value, String); + +// will return true if value is a String or an array of Numbers +Match.test(value, Match.OneOf(String, [Number])); +``` + +This can be useful if you have a function that accepts several different kinds +of objects, and you want to determine which was passed in. + +{{> apiBoxTitle name="Match Patterns" id="matchpatterns"}} + +The following patterns can be used as pattern arguments to +[`check`](#check) and `Match.test`: + + +
+{{#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}} +
+ +{{/template}} \ No newline at end of file diff --git a/docs/client/api/collections.md b/docs/client/api/collections.md new file mode 100644 index 0000000000..50900cc514 --- /dev/null +++ b/docs/client/api/collections.md @@ -0,0 +1,827 @@ +{{#template name="api_collections"}} + + +

Collections

+ +Meteor stores data in *collections*. To get started, declare a +collection with `new Mongo.Collection`. + +{{> autoApiBox "Mongo.Collection"}} + +Calling this function is analogous to declaring a model in a traditional ORM +(Object-Relation Mapper)-centric framework. It sets up a *collection* (a storage +space for records, or "documents") that can be used to store a particular type +of information, like users, posts, scores, todo items, or whatever matters to +your application. Each document is a EJSON object. It includes an `_id` +property whose value is unique in the collection, which Meteor will set when you +first create the document. + + // common code on client and server declares a DDP-managed mongo + // collection. + Chatrooms = new Mongo.Collection("chatrooms"); + Messages = new Mongo.Collection("messages"); + +The function returns an object with methods to [`insert`](#insert) +documents in the collection, [`update`](#update) their properties, and +[`remove`](#remove) them, and to [`find`](#find) the documents in the +collection that match arbitrary criteria. The way these methods work is +compatible with the popular Mongo database API. The same database API +works on both the client and the server (see below). + + // return array of my messages + var myMessages = Messages.find({userId: Session.get('myUserId')}).fetch(); + + // create a new message + Messages.insert({text: "Hello, world!"}); + + // mark my first message as "important" + Messages.update(myMessages[0]._id, {$set: {important: true}}); + +If you pass a `name` when you create the collection, then you are +declaring a persistent collection — one that is stored on the +server and seen by all users. Client code and server code can both +access the same collection using the same API. + +Specifically, when you pass a `name`, here's what happens: + +* On the server (if you do not specify a `connection`), a collection with that +name is created on a backend Mongo server. When you call methods on that +collection on the server, they translate directly into normal Mongo operations +(after checking that they match your [access control rules](#allow)). + +* On the client (and on the server if you specify a `connection`), a Minimongo +instance is created. Minimongo is essentially an in-memory, non-persistent +implementation of Mongo in pure JavaScript. It serves as a local cache that +stores just the subset of the database that this client is working with. Queries +([`find`](#find)) on these collections are served directly out of this cache, +without talking to the server. + +* When you write to the database on the client ([`insert`](#insert), +[`update`](#update), [`remove`](#remove)), the command is executed locally +immediately, and, simultaneously, it's sent to the server and executed +there too. This happens via [stubs](#meteor_methods), because writes are +implemented as methods. + +{{#note}} +When, on the server, you write to a collection which has a specified +`connection` to another server, it sends the corresponding method to the other +server and receives the changed values back from it over DDP. Unlike on the +client, it does not execute the write locally first. +{{/note}} + +If you pass `null` as the `name`, then you're creating a local +collection. It's not synchronized anywhere; it's just a local scratchpad +that supports Mongo-style [`find`](#find), [`insert`](#insert), +[`update`](#update), and [`remove`](#remove) operations. (On both the +client and the server, this scratchpad is implemented using Minimongo.) + +By default, Meteor automatically publishes every document in your +collection to each connected client. To turn this behavior off, remove +the `autopublish` package: + + $ meteor remove autopublish + +and instead call [`Meteor.publish`](#meteor_publish) to specify which parts of +your collection should be published to which users. + + // Create a collection called Posts and put a document in it. The + // document will be immediately visible in the local copy of the + // collection. It will be written to the server-side database + // a fraction of a second later, and a fraction of a second + // after that, it will be synchronized down to any other clients + // that are subscribed to a query that includes it (see + // Meteor.subscribe and autopublish) + Posts = new Mongo.Collection("posts"); + Posts.insert({title: "Hello world", body: "First post"}); + + // Changes are visible immediately -- no waiting for a round trip to + // the server. + assert(Posts.find().count() === 1); + + // Create a temporary, local collection. It works just like any other + // collection, but it doesn't send changes to the server, and it + // can't receive any data from subscriptions. + Scratchpad = new Mongo.Collection; + for (var i = 0; i < 10; i++) + Scratchpad.insert({number: i * 2}); + assert(Scratchpad.find({number: {$lt: 9}}).count() === 5); + +Generally, you'll assign `Mongo.Collection` objects in your app to global +variables. You can only create one `Mongo.Collection` object for each +underlying Mongo collection. + +If you specify a `transform` option to the `Collection` or any of its retrieval +methods, documents are passed through the `transform` function before being +returned or passed to callbacks. This allows you to add methods or otherwise +modify the contents of your collection from their database representation. You +can also specify `transform` on a particular `find`, `findOne`, `allow`, or +`deny` call. Transform functions must return an object and they may not change +the value of the document's `_id` field (though it's OK to leave it out). + + // An Animal class that takes a document in its constructor + Animal = function (doc) { + _.extend(this, doc); + }; + _.extend(Animal.prototype, { + makeNoise: function () { + console.log(this.sound); + } + }); + + // Define a Collection that uses Animal as its document + Animals = new Mongo.Collection("Animals", { + transform: function (doc) { return new Animal(doc); } + }); + + // Create an Animal and call its makeNoise method + Animals.insert({name: "raptor", sound: "roar"}); + Animals.findOne({name: "raptor"}).makeNoise(); // prints "roar" + +`transform` functions are not called reactively. If you want to add a +dynamically changing attribute to an object, do it with a function that computes +the value at the time it's called, not by computing the attribute at `transform` +time. + +{{#warning}} +In this release, Minimongo has some limitations: + +* `$pull` in modifiers can only accept certain kinds +of selectors. +* `findAndModify`, aggregate functions, and +map/reduce aren't supported. + +All of these will be addressed in a future release. For full +Minimongo release notes, see packages/minimongo/NOTES +in the repository. +{{/warning}} + +{{#warning}} +Minimongo doesn't currently have indexes. It's rare for this to be an +issue, since it's unusual for a client to have enough data that an +index is worthwhile. +{{/warning}} + +{{> autoApiBox "Mongo.Collection#find"}} + +`find` returns a cursor. It does not immediately access the database or return +documents. Cursors provide `fetch` to return all matching documents, `map` and +`forEach` to iterate over all matching documents, and `observe` and +`observeChanges` to register callbacks when the set of matching documents +changes. + +{{#warning}} +Collection cursors are not query snapshots. If the database changes +between calling `Collection.find` and fetching the +results of the cursor, or while fetching results from the cursor, +those changes may or may not appear in the result set. +{{/warning}} + +Cursors are a reactive data source. On the client, the first time you retrieve a +cursor's documents with `fetch`, `map`, or `forEach` inside a +reactive computation (eg, a template or +[`autorun`](#tracker_autorun)), Meteor will register a +dependency on the underlying data. Any change to the collection that +changes the documents in a cursor will trigger a recomputation. To +disable this behavior, pass `{reactive: false}` as an option to +`find`. + +Note that when `fields` are specified, only changes to the included +fields will trigger callbacks in `observe`, `observeChanges` and +invalidations in reactive computations using this cursor. Careful use +of `fields` allows for more fine-grained reactivity for computations +that don't depend on an entire document. + +{{> autoApiBox "Mongo.Collection#findOne"}} + +Equivalent to `find(selector, options).fetch()[0]` with +`options.limit = 1`. + +{{> autoApiBox "Mongo.Collection#insert"}} + +Add a document to the collection. A document is just an object, and +its fields can contain any combination of EJSON-compatible datatypes +(arrays, objects, numbers, strings, `null`, true, and false). + +`insert` will generate a unique ID for the object you pass, insert it +in the database, and return the ID. When `insert` is called from +untrusted client code, it will be allowed only if passes any +applicable [`allow`](#allow) and [`deny`](#deny) rules. + +On the server, if you don't provide a callback, then `insert` blocks +until the database acknowledges the write, or throws an exception if +something went wrong. If you do provide a callback, `insert` still +returns the ID immediately. Once the insert completes (or fails), the +callback is called with error and result arguments. In an error case, +`result` is undefined. If the insert is successful, `error` is +undefined and `result` is the new document ID. + +On the client, `insert` never blocks. If you do not provide a callback +and the insert fails on the server, then Meteor will log a warning to +the console. If you provide a callback, Meteor will call that function +with `error` and `result` arguments. In an error case, `result` is +undefined. If the insert is successful, `error` is undefined and +`result` is the new document ID. + +Example: + + var groceriesId = Lists.insert({name: "Groceries"}); + Items.insert({list: groceriesId, name: "Watercress"}); + Items.insert({list: groceriesId, name: "Persimmons"}); + +{{> autoApiBox "Mongo.Collection#update"}} + +Modify documents that match `selector` according to `modifier` (see +[modifier documentation](#modifiers)). + +The behavior of `update` differs depending on whether it is called by +trusted or untrusted code. Trusted code includes server code and +method code. Untrusted code includes client-side code such as event +handlers and a browser's JavaScript console. + +- Trusted code can modify multiple documents at once by setting + `multi` to true, and can use an arbitrary [Mongo + selector](#selectors) to find the documents to modify. It bypasses + any access control rules set up by [`allow`](#allow) and + [`deny`](#deny). The number of affected documents will be returned + from the `update` call if you don't pass a callback. + +- Untrusted code can only modify a single document at once, specified + by its `_id`. The modification is allowed only after checking any + applicable [`allow`](#allow) and [`deny`](#deny) rules. The number + of affected documents will be returned to the callback. Untrusted + code cannot perform upserts, except in insecure mode. + +On the server, if you don't provide a callback, then `update` blocks +until the database acknowledges the write, or throws an exception if +something went wrong. If you do provide a callback, `update` returns +immediately. Once the update completes, the callback is called with a +single error argument in the case of failure, or a second argument +indicating the number of affected documents if the update was successful. + +On the client, `update` never blocks. If you do not provide a callback +and the update fails on the server, then Meteor will log a warning to +the console. If you provide a callback, Meteor will call that function +with an error argument if there was an error, or a second argument +indicating the number of affected documents if the update was successful. + +Client example: + + // When the givePoints button in the admin dashboard is pressed, + // give 5 points to the current player. The new score will be + // immediately visible on everyone's screens. + Template.adminDashboard.events({ + 'click .givePoints': function () { + Players.update(Session.get("currentPlayer"), {$inc: {score: 5}}); + } + }); + +Server example: + + // Give the "Winner" badge to each user with a score greater than + // 10. If they are logged in and their badge list is visible on the + // screen, it will update automatically as they watch. + Meteor.methods({ + declareWinners: function () { + Players.update({score: {$gt: 10}}, + {$addToSet: {badges: "Winner"}}, + {multi: true}); + } + }); + +You can use `update` to perform a Mongo upsert by setting the `upsert` +option to true. You can also use the [`upsert`](#upsert) method to perform an +upsert that returns the _id of the document that was inserted (if there was one) +in addition to the number of affected documents. + +{{> autoApiBox "Mongo.Collection#upsert"}} + +Modify documents that match `selector` according to `modifier`, or insert +a document if no documents were modified. `upsert` is the same as calling +`update` with the `upsert` option set to true, except that the return +value of `upsert` is an object that contain the keys `numberAffected` +and `insertedId`. (`update` returns only the number of affected documents.) + +{{> autoApiBox "Mongo.Collection#remove"}} + +Find all of the documents that match `selector` and delete them from +the collection. + +The behavior of `remove` differs depending on whether it is called by +trusted or untrusted code. Trusted code includes server code and +method code. Untrusted code includes client-side code such as event +handlers and a browser's JavaScript console. + +- Trusted code can use an arbitrary [Mongo selector](#selectors) to + find the documents to remove, and can remove more than one document + at once by passing a selector that matches multiple documents. It + bypasses any access control rules set up by [`allow`](#allow) and + [`deny`](#deny). The number of removed documents will be returned + from `remove` if you don't pass a callback. + + As a safety measure, if `selector` is omitted (or is `undefined`), + no documents will be removed. Set `selector` to `{}` if you really + want to remove all documents from your collection. + +- Untrusted code can only remove a single document at a time, + specified by its `_id`. The document is removed only after checking + any applicable [`allow`](#allow) and [`deny`](#deny) rules. The + number of removed documents will be returned to the callback. + +On the server, if you don't provide a callback, then `remove` blocks +until the database acknowledges the write and then returns the number +of removed documents, or throws an exception if +something went wrong. If you do provide a callback, `remove` returns +immediately. Once the remove completes, the callback is called with a +single error argument in the case of failure, or a second argument +indicating the number of removed documents if the remove was successful. + +On the client, `remove` never blocks. If you do not provide a callback +and the remove fails on the server, then Meteor will log a warning to the +console. If you provide a callback, Meteor will call that function with an +error argument if there was an error, or a second argument indicating the number +of removed documents if the remove was successful. + +Client example: + + // When the remove button is clicked on a chat message, delete + // that message. + Template.chat.events({ + 'click .remove': function () { + Messages.remove(this._id); + } + }); + +Server example: + + // When the server starts, clear the log, and delete all players + // with a karma of less than -2. + Meteor.startup(function () { + if (Meteor.isServer) { + Logs.remove({}); + Players.remove({karma: {$lt: -2}}); + } + }); + +{{> autoApiBox "Mongo.Collection#allow"}} + +When a client calls `insert`, `update`, or `remove` on a collection, the +collection's `allow` and [`deny`](#deny) callbacks are called +on the server to determine if the write should be allowed. If at least +one `allow` callback allows the write, and no `deny` callbacks deny the +write, then the write is allowed to proceed. + +These checks are run only when a client tries to write to the database +directly, for example by calling `update` from inside an event +handler. Server code is trusted and isn't subject to `allow` and `deny` +restrictions. That includes methods that are called with `Meteor.call` +— they are expected to do their own access checking rather than +relying on `allow` and `deny`. + +You can call `allow` as many times as you like, and each call can +include any combination of `insert`, `update`, and `remove` +functions. The functions should return `true` if they think the +operation should be allowed. Otherwise they should return `false`, or +nothing at all (`undefined`). In that case Meteor will continue +searching through any other `allow` rules on the collection. + +The available callbacks are: + +
+{{#dtdd "insert(userId, doc)"}} +The user `userId` wants to insert the document `doc` into the +collection. Return `true` if this should be allowed. + +`doc` will contain the `_id` field if one was explicitly set by the client, or +if there is an active `transform`. You can use this to prevent users from +specifying arbitrary `_id` fields. +{{/dtdd}} + +{{#dtdd "update(userId, doc, fieldNames, modifier)"}} + +The user `userId` wants to update a document `doc`. (`doc` is the +current version of the document from the database, without the +proposed update.) Return `true` to permit the change. + +`fieldNames` is an array of the (top-level) fields in `doc` that the +client wants to modify, for example +`['name',` `'score']`. + +`modifier` is the raw Mongo modifier that +the client wants to execute; for example, +`{$set: {'name.first': "Alice"}, $inc: {score: 1}}`. + +Only Mongo modifiers are supported (operations like `$set` and `$push`). +If the user tries to replace the entire document rather than use +$-modifiers, the request will be denied without checking the `allow` +functions. + +{{/dtdd}} + +{{#dtdd "remove(userId, doc)"}} + +The user `userId` wants to remove `doc` from the database. Return +`true` to permit this. + +{{/dtdd}} + +
+ +When calling `update` or `remove` Meteor will by default fetch the +entire document `doc` from the database. If you have large documents +you may wish to fetch only the fields that are actually used by your +functions. Accomplish this by setting `fetch` to an array of field +names to retrieve. + +Example: + + // Create a collection where users can only modify documents that + // they own. Ownership is tracked by an 'owner' field on each + // document. All documents must be owned by the user that created + // them and ownership can't be changed. Only a document's owner + // is allowed to delete it, and the 'locked' attribute can be + // set on a document to prevent its accidental deletion. + + Posts = new Mongo.Collection("posts"); + + Posts.allow({ + insert: function (userId, doc) { + // the user must be logged in, and the document must be owned by the user + return (userId && doc.owner === userId); + }, + update: function (userId, doc, fields, modifier) { + // can only change your own documents + return doc.owner === userId; + }, + remove: function (userId, doc) { + // can only remove your own documents + return doc.owner === userId; + }, + fetch: ['owner'] + }); + + Posts.deny({ + update: function (userId, docs, fields, modifier) { + // can't change owners + return _.contains(fields, 'owner'); + }, + remove: function (userId, doc) { + // can't remove locked documents + return doc.locked; + }, + fetch: ['locked'] // no need to fetch 'owner' + }); + +If you never set up any `allow` rules on a collection then all client +writes to the collection will be denied, and it will only be possible to +write to the collection from server-side code. In this case you will +have to create a method for each possible write that clients are allowed +to do. You'll then call these methods with `Meteor.call` rather than +having the clients call `insert`, `update`, and `remove` directly on the +collection. + +Meteor also has a special "insecure mode" for quickly prototyping new +applications. In insecure mode, if you haven't set up any `allow` or `deny` +rules on a collection, then all users have full write access to the +collection. This is the only effect of insecure mode. If you call `allow` or +`deny` at all on a collection, even `Posts.allow({})`, then access is checked +just like normal on that collection. __New Meteor projects start in insecure +mode by default.__ To turn it off just run `$ meteor remove insecure`. + +{{> autoApiBox "Mongo.Collection#deny"}} + +This works just like [`allow`](#allow), except it lets you +make sure that certain writes are definitely denied, even if there is an +`allow` rule that says that they should be permitted. + +When a client tries to write to a collection, the Meteor server first +checks the collection's `deny` rules. If none of them return true then +it checks the collection's `allow` rules. Meteor allows the write only +if no `deny` rules return `true` and at least one `allow` rule returns +`true`. + +

Cursors

+ +To create a cursor, use [`find`](#find). To access the documents in a +cursor, use [`forEach`](#foreach), [`map`](#map), or [`fetch`](#fetch). + +{{> autoApiBox "Mongo.Cursor#forEach"}} + +This interface is compatible with [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach). + +When called from a reactive computation, `forEach` registers dependencies on +the matching documents. + +Examples: + + // Print the titles of the five top-scoring posts + var topPosts = Posts.find({}, {sort: {score: -1}, limit: 5}); + var count = 0; + topPosts.forEach(function (post) { + console.log("Title of post " + count + ": " + post.title); + count += 1; + }); + +{{> autoApiBox "Mongo.Cursor#map"}} + +This interface is compatible with [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map). + +When called from a reactive computation, `map` registers dependencies on +the matching documents. + + +On the server, if `callback` yields, other calls to `callback` may occur while +the first call is waiting. If strict sequential execution is necessary, use +`forEach` instead. + +{{> autoApiBox "Mongo.Cursor#fetch"}} + +When called from a reactive computation, `fetch` registers dependencies on +the matching documents. + +{{> autoApiBox "Mongo.Cursor#count"}} + +Unlike the other functions, `count` registers a dependency only on the +number of matching documents. (Updates that just change or reorder the +documents in the result set will not trigger a recomputation.) + +{{> autoApiBox "Mongo.Cursor#observe"}} + +Establishes a *live query* that invokes callbacks when the result of +the query changes. The callbacks receive the entire contents of the +document that was affected, as well as its old contents, if +applicable. If you only need to receive the fields that changed, see +[`observeChanges`](#observe_changes). + +`callbacks` may have the following functions as properties: + +
+
added(document) or
+
addedAt(document, atIndex, before)
+
+{{#markdown}} +A new document `document` entered the result set. The new document +appears at position `atIndex`. It is immediately before the document +whose `_id` is `before`. `before` will be `null` if the new document +is at the end of the results. +{{/markdown}} +
+ +
changed(newDocument, oldDocument) + or
+
changedAt(newDocument, oldDocument, atIndex)
+
+{{#markdown}} +The contents of a document were previously `oldDocument` and are now +`newDocument`. The position of the changed document is `atIndex`. +{{/markdown}} +
+ +
removed(oldDocument) + or
+
removedAt(oldDocument, atIndex)
+
+{{#markdown}} +The document `oldDocument` is no longer in the result set. It used to be at position `atIndex`. +{{/markdown}} +
+ +{{#dtdd "movedTo(document, fromIndex, toIndex, before)"}} +A document changed its position in the result set, from `fromIndex` to `toIndex` +(which is before the document with id `before`). Its current contents is +`document`. +{{/dtdd}} +
+ +Use `added`, `changed`, and `removed` when you don't care about the +order of the documents in the result set. They are more efficient than +`addedAt`, `changedAt`, and `removedAt`. + +Before `observe` returns, `added` (or `addedAt`) will be called zero +or more times to deliver the initial results of the query. + +`observe` returns a live query handle, which is an object with a `stop` method. +Call `stop` with no arguments to stop calling the callback functions and tear +down the query. **The query will run forever until you call this.** If +`observe` is called from a `Tracker.autorun` computation, it is automatically +stopped when the computation is rerun or stopped. +(If the cursor was created with the option `reactive` set to false, it will +only deliver the initial results and will not call any further callbacks; +it is not necessary to call `stop` on the handle.) + + +{{> autoApiBox "Mongo.Cursor#observeChanges"}} + +Establishes a *live query* that invokes callbacks when the result of +the query changes. In contrast to [`observe`](#observe), +`observeChanges` provides only the difference between the old and new +result set, not the entire contents of the document that changed. + +`callbacks` may have the following functions as properties: + +
+
added(id, fields) + or
+
addedBefore(id, fields, before)
+
+{{#markdown}} +A new document entered the result set. It has the `id` and `fields` +specified. `fields` contains all fields of the document excluding the +`_id` field. The new document is before the document identified by +`before`, or at the end if `before` is `null`. +{{/markdown}} +
+ +{{#dtdd "changed(id, fields)"}} +The document identified by `id` has changed. `fields` contains the +changed fields with their new values. If a field was removed from the +document then it will be present in `fields` with a value of +`undefined`. +{{/dtdd}} + +{{#dtdd "movedBefore(id, before)"}} +The document identified by `id` changed its position in the ordered result set, +and now appears before the document identified by `before`. +{{/dtdd}} + +{{#dtdd "removed(id)"}} +The document identified by `id` was removed from the result set. +{{/dtdd}} +
+ +`observeChanges` is significantly more efficient if you do not use +`addedBefore` or `movedBefore`. + +Before `observeChanges` returns, `added` (or `addedBefore`) will be called +zero or more times to deliver the initial results of the query. + +`observeChanges` returns a live query handle, which is an object with a `stop` +method. Call `stop` with no arguments to stop calling the callback functions +and tear down the query. **The query will run forever until you call this.** +If +`observeChanges` is called from a `Tracker.autorun` computation, it is automatically +stopped when the computation is rerun or stopped. +(If the cursor was created with the option `reactive` set to false, it will +only deliver the initial results and will not call any further callbacks; +it is not necessary to call `stop` on the handle.) + +{{#note}} +Unlike `observe`, `observeChanges` does not provide absolute position +information (that is, `atIndex` positions rather than `before` +positions.) This is for efficiency. +{{/note}} + +Example: + + // Keep track of how many administrators are online. + var count = 0; + var query = Users.find({admin: true, onlineNow: true}); + var handle = query.observeChanges({ + added: function (id, user) { + count++; + console.log(user.name + " brings the total to " + count + " admins."); + }, + removed: function () { + count--; + console.log("Lost one. We're now down to " + count + " admins."); + } + }); + + // After five seconds, stop keeping the count. + setTimeout(function () {handle.stop();}, 5000); + +{{> autoApiBox "Mongo.ObjectID"}} + +`Mongo.ObjectID` follows the same API as the [Node MongoDB driver +`ObjectID`](http://mongodb.github.com/node-mongodb-native/api-bson-generated/objectid.html) +class. Note that you must use the `equals` method (or [`EJSON.equals`](#ejson_equals)) to +compare them; the `===` operator will not work. If you are writing generic code +that needs to deal with `_id` fields that may be either strings or `ObjectID`s, use +[`EJSON.equals`](#ejson_equals) instead of `===` to compare them. + +{{#note}} + `ObjectID` values created by Meteor will not have meaningful answers to their `getTimestamp` + method, since Meteor currently constructs them fully randomly. +{{/note}} + + + +{{> apiBoxTitle name="Mongo-Style Selectors" id="selectors"}} + +The simplest selectors are just a string or +[`Mongo.ObjectID`](#mongo_object_id). These selectors match the +document with that value in its `_id` field. + +A slightly more complex form of selector is an object containing a set of keys +that must match in a document: + + // Matches all documents where deleted is false + {deleted: false} + + // Matches all documents where the name and cognomen are as given + {name: "Rhialto", cognomen: "the Marvelous"} + + // Matches every document + {} + +But they can also contain more complicated tests: + + // Matches documents where age is greater than 18 + {age: {$gt: 18}} + + // Also matches documents where tags is an array containing "popular" + {tags: "popular"} + + // Matches documents where fruit is one of three possibilities + {fruit: {$in: ["peach", "plum", "pear"]}} + +See the [complete +documentation](http://docs.mongodb.org/manual/reference/operator/). + +{{> apiBoxTitle name="Mongo-Style Modifiers" id="modifiers"}} + +A modifier is an object that describes how to update a document in +place by changing some of its fields. Some examples: + + // Set the 'admin' property on the document to true + {$set: {admin: true}} + + // Add 2 to the 'votes' property, and add "Traz" + // to the end of the 'supporters' array + {$inc: {votes: 2}, $push: {supporters: "Traz"}} + +But if a modifier doesn't contain any $-operators, then it is instead +interpreted as a literal document, and completely replaces whatever was +previously in the database. (Literal document modifiers are not currently +supported by [validated updates](#allow).) + + // Find the document with id "123", and completely replace it. + Users.update({_id: "123"}, {name: "Alice", friends: ["Bob"]}); + +See the [full list of +modifiers](http://docs.mongodb.org/manual/reference/operator/update/). + + +{{> apiBoxTitle name="Sort Specifiers" id="sortspecifiers"}} + +Sorts may be specified using your choice of several syntaxes: + + // All of these do the same thing (sort in ascending order by + // key "a", breaking ties in descending order of key "b") + + [["a", "asc"], ["b", "desc"]] + ["a", ["b", "desc"]] + {a: 1, b: -1} + +The last form will only work if your JavaScript implementation +preserves the order of keys in objects. Most do, most of the time, but +it's up to you to be sure. + + + +{{> apiBoxTitle name="Field Specifiers" id="fieldspecifiers"}} + +Queries can specify a particular set of fields to include or exclude from the +result object. + +To exclude specific fields from the result objects, the field specifier is a +dictionary whose keys are field names and whose values are `0`. All unspecified +fields are included. + + // Users.find({}, {fields: {password: 0, hash: 0}}) + +To include only specific fields in the result documents, use `1` as +the value. The `_id` field is still included in the result. + + // Users.find({}, {fields: {firstname: 1, lastname: 1}}) + +With one exception, it is not possible to mix inclusion and exclusion styles: +the keys must either be all 1 or all 0. The exception is that you may specify +`_id: 0` in an inclusion specifier, which will leave `_id` out of the result +object as well. However, such field specifiers can not be used with +[`observeChanges`](#observe_changes), [`observe`](#observe), cursors returned +from a [publish function](#meteor_publish), or cursors used in +`{{dstache}}#each}}` in a template. They may be used with [`fetch`](#fetch), +[`findOne`](#findone), [`forEach`](#foreach), and [`map`](#map). + + +Field +operators such as `$` and `$elemMatch` are not available on the client side +yet. + +A more advanced example: + + Users.insert({ alterEgos: [{ name: "Kira", alliance: "murderer" }, + { name: "L", alliance: "police" }], + name: "Yagami Light" }); + + Users.findOne({}, { fields: { 'alterEgos.name': 1, _id: 0 } }); + + // returns { alterEgos: [{ name: "Kira" }, { name: "L" }] } + +See +the MongoDB docs for details of the nested field rules and array behavior. + + + +{{/template}} \ No newline at end of file diff --git a/docs/client/api/connections.md b/docs/client/api/connections.md new file mode 100644 index 0000000000..4027c99878 --- /dev/null +++ b/docs/client/api/connections.md @@ -0,0 +1,168 @@ +{{#template name="api_connections"}} + +

Server connections

+ +These functions manage and inspect the network connection between the +Meteor client and server. + +{{> autoApiBox "Meteor.status"}} + +This method returns the status of the connection between the client and +the server. The return value is an object with the following fields: + +
+{{#dtdd name="connected" type="Boolean"}} + True if currently connected to the server. If false, changes and + method invocations will be queued up until the connection is + reestablished. +{{/dtdd}} + +{{#dtdd name="status" type="String"}} + Describes the current reconnection status. The possible + values are `connected` (the connection is up and + running), `connecting` (disconnected and trying to open a + new connection), `failed` (permanently failed to connect; e.g., the client + and server support different versions of DDP), `waiting` (failed + to connect and waiting to try to reconnect) and `offline` (user has disconnected the connection). +{{/dtdd}} + +{{#dtdd name="retryCount" type="Number"}} + The number of times the client has tried to reconnect since the + connection was lost. 0 when connected. +{{/dtdd}} + +{{#dtdd name="retryTime" type="Number or undefined"}} + The estimated time of the next reconnection attempt. To turn this + into an interval until the next reconnection, use + `retryTime - (new Date()).getTime()`. This key will + be set only when `status` is `waiting`. +{{/dtdd}} + +{{#dtdd name="reason" type="String or undefined"}} + If `status` is `failed`, a description of why the connection failed. +{{/dtdd}} +
+ +Instead of using callbacks to notify you on changes, this is +a [reactive](#reactivity) data source. You can use it in a +[template](#livehtmltemplates) or [computation](#tracker_autorun) +to get realtime updates. + +{{> autoApiBox "Meteor.reconnect"}} + +{{> autoApiBox "Meteor.disconnect"}} + +Call this method to disconnect from the server and stop all +live data updates. While the client is disconnected it will not receive +updates to collections, method calls will be queued until the +connection is reestablished, and hot code push will be disabled. + +Call [Meteor.reconnect](#meteor_reconnect) to reestablish the connection +and resume data transfer. + +This can be used to save battery on mobile devices when real time +updates are not required. + + +{{> autoApiBox "Meteor.onConnection"}} + +`onConnection` returns an object with a single method `stop`. Calling +`stop` unregisters the callback, so that this callback will no longer +be called on new connections. + +The callback is called with a single argument, the server-side +`connection` representing the connection from the client. This object +contains the following fields: + +
+{{#dtdd name="id" type="String"}} +A globally unique id for this connection. +{{/dtdd}} + +{{#dtdd name="close" type="Function"}} +Close this DDP connection. The client is free to reconnect, but will +receive a different connection with a new `id` if it does. +{{/dtdd}} + +{{#dtdd name="onClose" type="Function"}} +Register a callback to be called when the connection is closed. If the +connection is already closed, the callback will be called immediately. +{{/dtdd}} + +{{#dtdd name="clientAddress" type="String"}} + The IP address of the client in dotted form (such as `"127.0.0.1"`). + + If you're running your Meteor server behind a proxy (so that clients + are connecting to the proxy instead of to your server directly), + you'll need to set the `HTTP_FORWARDED_COUNT` environment variable + for the correct IP address to be reported by `clientAddress`. + + Set `HTTP_FORWARDED_COUNT` to an integer representing the number of + proxies in front of your server. For example, you'd set it to `"1"` + when your server was behind one proxy. +{{/dtdd}} + +{{#dtdd name="httpHeaders" type="Object"}} + When the connection came in over an HTTP transport (such as with + Meteor's default SockJS implementation), this field contains + whitelisted HTTP headers. + + Cookies are deliberately excluded from the headers as they are a + security risk for this transport. For details and alternatives, see + the [SockJS + documentation](https://github.com/sockjs/sockjs-node#authorisation). +{{/dtdd}} +
+ +{{#note}} + +Currently when a client reconnects to the server (such as after +temporarily losing its Internet connection), it will get a new +connection each time. The `onConnection` callbacks will be called +again, and the new connection will have a new connection `id`. + +In the future, when client reconnection is fully implemented, +reconnecting from the client will reconnect to the same connection on +the server: the `onConnection` callback won't be called for that +connection again, and the connection will still have the same +connection `id`. + +{{/note}} + + +{{> autoApiBox "DDP.connect"}} + +To call methods on another Meteor application or subscribe to its data +sets, call `DDP.connect` with the URL of the application. +`DDP.connect` returns an object which provides: + +* `subscribe` - + Subscribe to a record set. See + [Meteor.subscribe](#meteor_subscribe). +* `call` - + Invoke a method. See [Meteor.call](#meteor_call). +* `apply` - + Invoke a method with an argument array. See + [Meteor.apply](#meteor_apply). +* `methods` - + Define client-only stubs for methods defined on the remote server. See + [Meteor.methods](#meteor_methods). +* `status` - + Get the current connection status. See + [Meteor.status](#meteor_status). +* `reconnect` - + See [Meteor.reconnect](#meteor_reconnect). +* `disconnect` - + See [Meteor.disconnect](#meteor_disconnect). +* `onReconnect` - Set this to a function to be called as the first step of + reconnecting. This function can call methods which will be executed before + any other outstanding methods. For example, this can be used to re-establish + the appropriate authentication context on the new connection. + +By default, clients open a connection to the server from which they're loaded. +When you call `Meteor.subscribe`, `Meteor.status`, `Meteor.call`, and +`Meteor.apply`, you are using a connection back to that default +server. + + +{{/template}} \ No newline at end of file diff --git a/docs/client/api/core.md b/docs/client/api/core.md new file mode 100644 index 0000000000..afc16d7aec --- /dev/null +++ b/docs/client/api/core.md @@ -0,0 +1,47 @@ +{{#template name="api_core"}} + +

Meteor Core

+ +{{> autoApiBox "Meteor.isClient"}} +{{> autoApiBox "Meteor.isServer"}} + +{{#note}} +`Meteor.isServer` can be used to limit where code runs, but it does not +prevent code from being sent to the client. Any sensitive code that you +don't want served to the client, such as code containing passwords or +authentication mechanisms, should be kept in the `server` directory. +{{/note}} + +{{> autoApiBox "Meteor.isCordova"}} + +{{> autoApiBox "Meteor.startup"}} + +On a server, the function will run as soon as the server process is +finished starting. On a client, the function will run as soon as the DOM +is ready. + +The `startup` callbacks are called in the same order as the calls to +`Meteor.startup` were made. + +On a client, `startup` callbacks from packages will be called +first, followed by `` templates from your `.html` files, +followed by your application code. + + // On server startup, if the database is empty, create some initial data. + if (Meteor.isServer) { + Meteor.startup(function () { + if (Rooms.find().count() === 0) { + Rooms.insert({name: "Initial room"}); + } + }); + } + +{{> autoApiBox "Meteor.wrapAsync"}} + +{{> autoApiBox "Meteor.absoluteUrl"}} + +{{> autoApiBox "Meteor.settings"}} + +{{> autoApiBox "Meteor.release"}} + +{{/template}} \ No newline at end of file diff --git a/docs/client/api/ejson.md b/docs/client/api/ejson.md new file mode 100644 index 0000000000..2f2f0cbda2 --- /dev/null +++ b/docs/client/api/ejson.md @@ -0,0 +1,90 @@ +{{#template name="api_ejson"}} + +

EJSON

+ +EJSON is an extension of JSON to support more types. It supports all JSON-safe +types, as well as: + + - **Date** (JavaScript `Date`) + - **Binary** (JavaScript `Uint8Array` or the + result of [`EJSON.newBinary`](#ejson_new_binary)) + - **User-defined types** (see [`EJSON.addType`](#ejson_add_type). For example, + [`Mongo.ObjectID`](#mongo_object_id) is implemented this way.) + +All EJSON serializations are also valid JSON. For example an object with a date +and a binary buffer would be serialized in EJSON as: + + { + "d": {"$date": 1358205756553}, + "b": {"$binary": "c3VyZS4="} + } + +Meteor supports all built-in EJSON data types in publishers, method arguments +and results, Mongo databases, and [`Session`](#session) variables. + +{{> autoApiBox "EJSON.parse"}} + +{{> autoApiBox "EJSON.stringify"}} + +{{> autoApiBox "EJSON.fromJSONValue"}} + +{{> autoApiBox "EJSON.toJSONValue"}} + +{{> autoApiBox "EJSON.equals"}} + +{{> autoApiBox "EJSON.clone"}} + +{{> autoApiBox "EJSON.newBinary"}} + +Buffers of binary data are represented by `Uint8Array` instances on JavaScript +platforms that support them. On implementations of JavaScript that do not +support `Uint8Array`, binary data buffers are represented by standard arrays +containing numbers ranging from 0 to 255, and the `$Uint8ArrayPolyfill` key +set to `true`. + +{{> autoApiBox "EJSON.isBinary"}} + +{{> autoApiBox "EJSON.addType"}} + +When you add a type to EJSON, Meteor will be able to use that type in: + + - publishing objects of your type if you pass them to publish handlers. + - allowing your type in the return values or arguments to + [methods](#methods_header). + - storing your type client-side in Minimongo. + - allowing your type in [`Session`](#session) variables. + +Instances of your type must implement [`typeName`](#ejson_type_typeName) and +[`toJSONValue`](#ejson_type_toJSONValue) methods, and may implement +[`clone`](#ejson_type_clone) and [`equals`](#ejson_type_equals) methods if the +default implementations are not sufficient. + +{{> autoApiBox "EJSON.CustomType#typeName"}} +{{> autoApiBox "EJSON.CustomType#toJSONValue"}} + +For example, the `toJSONValue` method for +[`Mongo.ObjectID`](#mongo_object_id) could be: + + function () { + return this.toHexString(); + }; + +{{> autoApiBox "EJSON.CustomType#clone"}} + +If your type does not have a `clone` method, `EJSON.clone` will use +[`toJSONValue`](#ejson_type_toJSONValue) and the factory instead. + +{{> autoApiBox "EJSON.CustomType#equals"}} + +The `equals` method should define an [equivalence +relation](http://en.wikipedia.org/wiki/Equivalence_relation). It should have +the following properties: + + - *Reflexivity* - for any instance `a`: `a.equals(a)` must be true. + - *Symmetry* - for any two instances `a` and `b`: `a.equals(b)` if and only if `b.equals(a)`. + - *Transitivity* - for any three instances `a`, `b`, and `c`: `a.equals(b)` and `b.equals(c)` implies `a.equals(c)`. + +If your type does not have an `equals` method, `EJSON.equals` will compare the +result of calling [`toJSONValue`](#ejson_type_toJSONValue) instead. + +{{/template}} \ No newline at end of file diff --git a/docs/client/api/email.md b/docs/client/api/email.md new file mode 100644 index 0000000000..84dd34c5ec --- /dev/null +++ b/docs/client/api/email.md @@ -0,0 +1,57 @@ +{{#template name="api_email"}} + +

Email

+ +The `email` package allows sending email from a Meteor app. To use it, add the +package to your project with `$ meteor add email`. + +The server reads from the `MAIL_URL` environment variable to determine how to +send mail. Currently, Meteor supports sending mail over SMTP; the `MAIL_URL` +environment variable should be of the form +`smtp://USERNAME:PASSWORD@HOST:PORT/`. For apps deployed with `meteor deploy`, +`MAIL_URL` defaults to an account (provided by +[Mailgun](http://www.mailgun.com/)) which allows apps to send up to 200 emails +per day; you may override this default by assigning to `process.env.MAIL_URL` +before your first call to `Email.send`. + +If `MAIL_URL` is not set (eg, when running your application locally), +`Email.send` outputs the message to standard output instead. + +{{> autoApiBox "Email.send"}} + +You must provide the `from` option and at least one of `to`, `cc`, and `bcc`; +all other options are optional. + +`Email.send` only works on the server. Here is an example of how a +client could use a server method call to send an email. (In an actual +application, you'd need to be careful to limit the emails that a +client could send, to prevent your server from being used as a relay +by spammers.) + + // In your server code: define a method that the client can call + Meteor.methods({ + sendEmail: function (to, from, subject, text) { + check([to, from, subject, text], [String]); + + // Let other method calls from the same client start running, + // without waiting for the email sending to complete. + this.unblock(); + + Email.send({ + to: to, + from: from, + subject: subject, + text: text + }); + } + }); + + // In your client code: asynchronously send an email + Meteor.call('sendEmail', + 'alice@example.com', + 'bob@example.com', + 'Hello from Meteor!', + 'This is a test of Email.send.'); + + +{{/template}} \ No newline at end of file diff --git a/docs/client/api/http.md b/docs/client/api/http.md new file mode 100644 index 0000000000..4dea0368cf --- /dev/null +++ b/docs/client/api/http.md @@ -0,0 +1,102 @@ +{{#template name="api_http"}} + +

HTTP

+ +`HTTP` provides an HTTP request API on the client and server. To use +these functions, add the HTTP package to your project with `$ meteor add http`. + +{{> autoApiBox "HTTP.call"}} + +This function initiates an HTTP request to a remote server. + +On the server, this function can be run either synchronously or +asynchronously. If the callback is omitted, it runs synchronously +and the results are returned once the request completes successfully. +If the request was not successful, an error is thrown. +This is +useful when making server-to-server HTTP API calls from within Meteor +methods, as the method can succeed or fail based on the results of the +synchronous HTTP call. In this case, consider using +[`this.unblock()`](#method_unblock) to allow other methods on the same +connection to run in +the mean time. On the client, this function must be used +asynchronously by passing a callback. + +Both HTTP and HTTPS protocols are supported. The `url` argument must be +an absolute URL including protocol and host name on the server, but may be +relative to the current host on the client. The `query` option +replaces the query string of `url`. Parameters specified in `params` +that are put in the URL are appended to any query string. +For example, with a `url` of `"/path?query"` and +`params` of `{foo:"bar"}`, the final URL will be `"/path?query&foo=bar"`. + +The `params` are put in the URL or the request body, depending on the +type of request. In the case of request with no bodies, like GET and +HEAD, the parameters will always go in the URL. For a POST or other +type of request, the parameters will be encoded into the body with a +standard `x-www-form-urlencoded` content type, unless the `content` +or `data` option is used to specify a body, in which case the +parameters will be appended to the URL instead. + +When run in asynchronous mode, the callback receives two arguments, +`error` and `result`. The +`error` argument will contain an Error if the request fails in any +way, including a network error, time-out, or an HTTP status code in +the 400 or 500 range. In case of a 4xx/5xx HTTP status code, the +`response` property on `error` matches the contents of the result +object. When run in synchronous mode, either `result` is returned +from the function, or `error` is thrown. + +Contents of the result object: + +
+ +
statusCode + Number
+
Numeric HTTP result status code, or null on error.
+ +
content + String
+
The body of the HTTP response as a string.
+ +
data + Object or null
+
If the response headers indicate JSON content, this contains the body of the document parsed as a JSON object.
+ +
headers + Object
+
A dictionary of HTTP headers from the response.
+ +
+ +Example server method: + + Meteor.methods({checkTwitter: function (userId) { + check(userId, String); + this.unblock(); + try { + var result = HTTP.call("GET", "http://api.twitter.com/xyz", + {params: {user: userId}}); + return true; + } catch (e) { + // Got a network error, time-out or HTTP error in the 400 or 500 range. + return false; + } + }}); + +Example asynchronous HTTP call: + + HTTP.call("POST", "http://api.twitter.com/xyz", + {data: {some: "json", stuff: 1}}, + function (error, result) { + if (!error) { + Session.set("twizzled", true); + } + }); + + +{{> autoApiBox "HTTP.get"}} +{{> autoApiBox "HTTP.post"}} +{{> autoApiBox "HTTP.put"}} +{{> autoApiBox "HTTP.del"}} +{{/template}} \ No newline at end of file diff --git a/docs/client/api/methods.md b/docs/client/api/methods.md new file mode 100644 index 0000000000..fe5baf0066 --- /dev/null +++ b/docs/client/api/methods.md @@ -0,0 +1,167 @@ +{{#template name="api_methods"}} + +

Methods

+ +Methods are remote functions that Meteor clients can invoke. + +{{> autoApiBox "Meteor.methods"}} + +Example: + + Meteor.methods({ + foo: function (arg1, arg2) { + check(arg1, String); + check(arg2, [Number]); + // .. do stuff .. + if (you want to throw an error) + throw new Meteor.Error("pants-not-found", "Can't find my pants"); + return "some return value"; + }, + + bar: function () { + // .. do other stuff .. + return "baz"; + } + }); + +Calling `methods` on the server defines functions that can be called remotely by +clients. They should return an [EJSON](#ejson)-able value or throw an +exception. Inside your method invocation, `this` is bound to a method +invocation object, which provides the following: + +* `isSimulation`: a boolean value, true if this invocation is a stub. +* `unblock`: when called, allows the next method from this client to +begin running. +* `userId`: the id of the current user. +* `setUserId`: a function that associates the current client with a user. +* `connection`: on the server, the [connection](#meteor_onconnection) this method call was received on. + +Calling `methods` on the client defines *stub* functions associated with +server methods of the same name. You don't have to define a stub for +your method if you don't want to. In that case, method calls are just +like remote procedure calls in other systems, and you'll have to wait +for the results from the server. + +If you do define a stub, when a client invokes a server method it will +also run its stub in parallel. On the client, the return value of a +stub is ignored. Stubs are run for their side-effects: they are +intended to *simulate* the result of what the server's method will do, +but without waiting for the round trip delay. If a stub throws an +exception it will be logged to the console. + +You use methods all the time, because the database mutators +([`insert`](#insert), [`update`](#update), [`remove`](#remove)) are implemented +as methods. When you call any of these functions on the client, you're invoking +their stub version that update the local cache, and sending the same write +request to the server. When the server responds, the client updates the local +cache with the writes that actually occurred on the server. + +Since methods usually expect particular types as arguments, +use [`check`](#check) liberally to ensure your method arguments have +the correct [types and structure](#matchpatterns). + +{{> autoApiBox "MethodInvocation#userId"}} + +The user id is an arbitrary string — typically the id of the user record +in the database. You can set it with the `setUserId` function. If you're using +the [Meteor accounts system](#accounts_api) then this is handled for you. + +{{> autoApiBox "MethodInvocation#setUserId"}} + +Call this function to change the currently logged in user on the +connection that made this method call. This simply sets the value of +`userId` for future method calls received on this connection. Pass +`null` to log out the connection. + +If you are using the [built-in Meteor accounts system](#accounts_api) then this +should correspond to the `_id` field of a document in the +[`Meteor.users`](#meteor_users) collection. + +`setUserId` is not retroactive. It affects the current method call and +any future method calls on the connection. Any previous method calls on +this connection will still see the value of `userId` that was in effect +when they started. + +{{> autoApiBox "MethodInvocation#isSimulation"}} + +{{> autoApiBox "MethodInvocation#unblock"}} + +On the server, methods from a given client run one at a time. The N+1th +invocation from a client won't start until the Nth invocation +returns. However, you can change this by calling `this.unblock`. This +will allow the N+1th invocation to start running in a new fiber. + +{{> autoApiBox "MethodInvocation#connection"}} + +{{> autoApiBox "Meteor.Error"}} + +If you want to return an error from a method, throw an exception. Methods can +throw any kind of exception. But `Meteor.Error` is the only kind of error that +a server will send to the client. If a method function throws a different +exception, then it will be mapped to a sanitized version on the +wire. Specifically, if the `sanitizedError` field on the thrown error is set to +a `Meteor.Error`, then that error will be sent to the client. Otherwise, if no +sanitized version is available, the client gets +`Meteor.Error(500, 'Internal server error')`. + +{{> autoApiBox "Meteor.call"}} + +This is how to invoke a method. It will run the method on the server. If a +stub is available, it will also run the stub on the client. (See also +[`Meteor.apply`](#meteor_apply), which is identical to `Meteor.call` except that +you specify the parameters as an array instead of as separate arguments and you +can specify a few options controlling how the method is executed.) + +If you include a callback function as the last argument (which can't be +an argument to the method, since functions aren't serializable), the +method will run asynchronously: it will return nothing in particular and +will not throw an exception. When the method is complete (which may or +may not happen before `Meteor.call` returns), the callback will be +called with two arguments: `error` and `result`. If an error was thrown, +then `error` will be the exception object. Otherwise, `error` will be +undefined and the return value (possibly undefined) will be in `result`. + + // async call + Meteor.call('foo', 1, 2, function (error, result) { ... } ); + +If you do not pass a callback on the server, the method invocation will +block until the method is complete. It will eventually return the +return value of the method, or it will throw an exception if the method +threw an exception. (Possibly mapped to 500 Server Error if the +exception happened remotely and it was not a `Meteor.Error` exception.) + + // sync call + var result = Meteor.call('foo', 1, 2); + +On the client, if you do not pass a callback and you are not inside a +stub, `call` will return `undefined`, and you will have no way to get +the return value of the method. That is because the client doesn't have +fibers, so there is not actually any way it can block on the remote +execution of a method. + +Finally, if you are inside a stub on the client and call another +method, the other method is not executed (no RPC is generated, nothing +"real" happens). If that other method has a stub, that stub stands in +for the method and is executed. The method call's return value is the +return value of the stub function. The client has no problem executing +a stub synchronously, and that is why it's okay for the client to use +the synchronous `Meteor.call` form from inside a method body, as +described earlier. + +Meteor tracks the database writes performed by methods, both on the client and +the server, and does not invoke `asyncCallback` until all of the server's writes +replace the stub's writes in the local cache. In some cases, there can be a lag +between the method's return value being available and the writes being visible: +for example, if another method still outstanding wrote to the same document, the +local cache may not be up to date until the other method finishes as well. If +you want to process the method's result as soon as it arrives from the server, +even if the method's writes are not available yet, you can specify an +`onResultReceived` callback to [`Meteor.apply`](#meteor_apply). + +{{> autoApiBox "Meteor.apply"}} + +`Meteor.apply` is just like `Meteor.call`, except that the method arguments are +passed as an array rather than directly as arguments, and you can specify +options about how the client executes the method. + +{{/template}} \ No newline at end of file diff --git a/docs/client/api/mobile-config.md b/docs/client/api/mobile-config.md new file mode 100644 index 0000000000..65908161c3 --- /dev/null +++ b/docs/client/api/mobile-config.md @@ -0,0 +1,57 @@ +{{#template name="api_mobile_config"}} + + +

Mobile Config File

+ +If your Meteor application targets mobile platforms such as iOS or +Android, you can configure your app's metadata and build process +in a special top-level file called +`mobile-config.js` which is *not* included in your application and is used only +for this configuration. + +The code snippet below is an example `mobile-config.js` file. The rest of this +section will explain the specific API commands in greater detail. + +```javascript +// This section sets up some basic app metadata, +// the entire section is optional. +App.info({ + id: 'com.example.matt.uber', + name: 'über', + description: 'Get über power in one button click', + author: 'Matt Development Group', + email: 'contact@example.com', + website: 'http://example.com' +}); + +// Set up resources such as icons and launch screens. +App.icons({ + 'iphone': 'icons/icon-60.png', + 'iphone_2x': 'icons/icon-60@2x.png', + // ... more screen sizes and platforms ... +}); + +App.launchScreens({ + 'iphone': 'splash/Default~iphone.png', + 'iphone_2x': 'splash/Default@2x~iphone.png', + // ... more screen sizes and platforms ... +}); + +// Set PhoneGap/Cordova preferences +App.setPreference('BackgroundColor', '0xff0000ff'); +App.setPreference('HideKeyboardFormAccessoryBar', true); + +// Pass preferences for a particular PhoneGap/Cordova plugin +App.configurePlugin('com.phonegap.plugins.facebookconnect', { + APP_ID: '1234567890', + API_KEY: 'supersecretapikey' +}); +``` + + +{{> autoApiBox "App.info"}} +{{> autoApiBox "App.setPreference"}} +{{> autoApiBox "App.configurePlugin"}} +{{> autoApiBox "App.icons"}} +{{> autoApiBox "App.launchScreens"}} +{{/template}} \ No newline at end of file diff --git a/docs/client/api/packagejs.md b/docs/client/api/packagejs.md new file mode 100644 index 0000000000..ed6a6534b1 --- /dev/null +++ b/docs/client/api/packagejs.md @@ -0,0 +1,122 @@ +{{#template name="api_packagejs"}} + +

Package.js

+ +{{#markdown}} A package is a directory containing a package.js file, which +contains roughly three major sections: a basic description, a package +definition, and a test definition. By default, the directory name is the name of +the package. + +The `package.js` file below is an example of how to use the packaging API. The +rest of this section will explain the specific API commands in greater detail. + + + /* Information about this package */ + Package.describe({ + // Short two-sentence summary. + summary: "What this does", + // Version number. + version: "1.0.0", + // Optional. Default is package directory name. + name: "username:package-name", + // Optional github URL to your source repository. + git: "https://github.com/something/something.git", + }); + + /* This defines your actual package */ + Package.onUse(function (api) { + // If no version is specified for an 'api.use' dependency, use the + // one defined in Meteor 0.9.0. + api.versionsFrom('0.9.0'); + // Use Underscore package, but only on the server. + // Version not specified, so it will be as of Meteor 0.9.0. + api.use('underscore', 'server'); + // Use application-configuration package, version 1.0.0 or newer. + api.use('application-configuration@1.0.0'); + // Give users of this package access to the Templating package. + api.imply('templating') + // Export the object 'Email' to packages or apps that use this package. + api.export('Email', 'server'); + // Specify the source code for the package. + api.addFiles('email.js', 'server'); + }); + + /* This defines the tests for the package */ + Package.onTest(function (api) { + // Sets up a dependency on this package + api.use('username:package-name'); + // Allows you to use the 'tinytest' framework + api.use('tinytest@1.0.0'); + // Specify the source code for the package tests + api.addFiles('email_tests.js', 'server'); + }); + + /* This lets you use npm packages in your package*/ + Npm.depends({ + simplesmtp: "0.3.10", + "stream-buffers": "0.2.5"}); + +Build plugins are created with `_transitional_registerBuildPlugin`, an API that is +very much in flux. See the coffeescript package for an +example. Build plugins are fully-fledged Meteor programs in their own right and +have their own namespace, package dependencies, source files and npm +requirements. + +

Package Description

+ +Provide basic package information with `Package.describe(options)`. To publish a +package, you must define `summary` and `version`. + +{{/markdown}} + +{{> autoApiBox "Package.describe"}} + + +

Package Definition

+ +{{#markdown}} +Define dependencies and expose package methods with the +`Package.onUse` handler. This section lets you define what packages your package +depends on, what packages are implied by your package, and what object your +package is exported to. +{{/markdown}} + +{{> autoApiBox "Package.onUse"}} + +{{> autoApiBox "PackageAPI#versionsFrom" }} +{{> autoApiBox "PackageAPI#use" }} +{{> autoApiBox "PackageAPI#imply" }} +{{> autoApiBox "PackageAPI#export" }} +{{> autoApiBox "PackageAPI#addFiles" }} + +

Unit Tests

+ +{{#markdown}} +Set up your tests with the `Package.onTest` handler, which has an interface +that's parallel to that of the `onUse` handler. The tests will need to depend on +the package that you have just created. For example, if your package is the +`email` package, you have to call `api.use('email')` in order to test the +package. + +If you used `meteor create` to set up your package, Meteor will create the +required scaffolding in `package.js`, and you'll only need to add unit test code +in the `_test.js` file that was created. +{{/markdown}} + +{{> autoApiBox "Package.onTest"}} + + +

External Packages and Plugins

+ +{{#markdown}} +Meteor packages can include NPM packages and Cordova plugins by using +`Npm.depends` and `Cordova.depends` in the `package.js` file. +{{/markdown}} + +{{> autoApiBox "Npm.depends"}} +{{> autoApiBox "Npm.require"}} +{{> autoApiBox "Cordova.depends"}} +{{> autoApiBox "Package.registerBuildPlugin"}} +{{> autoApiBox "Plugin.registerSourceHandler"}} + +{{/template}} \ No newline at end of file diff --git a/docs/client/api/passwords.md b/docs/client/api/passwords.md new file mode 100644 index 0000000000..de81fef3da --- /dev/null +++ b/docs/client/api/passwords.md @@ -0,0 +1,148 @@ +{{#template name="api_passwords"}} + +

Passwords

+ +The `accounts-password` package contains a full system for password-based +authentication. In addition to the basic username and password-based +sign-in process, it also supports email-based sign-in including +address verification and password recovery emails. + +The Meteor server stores passwords using the +[bcrypt](http://en.wikipedia.org/wiki/Bcrypt) algorithm. This helps +protect against embarrassing password leaks if the server's database is +compromised. + +To add password support to your application, run `$ meteor add +accounts-password`. You can construct your own user interface using the +functions below, or use the [`accounts-ui` package](#accountsui) to +include a turn-key user interface for password-based sign-in. + + +{{> autoApiBox "Accounts.createUser"}} + +On the client, this function logs in as the newly created user on +successful completion. On the server, it returns the newly created user +id. + +On the client, you must pass `password` and at least one of `username` or +`email` — enough information for the user to be able to log in again +later. On the server, you do not need to specify `password`, but the user will +not be able to log in until it has a password (eg, set with +[`Accounts.setPassword`](#accounts_setpassword)). + +To create an account without a password on the server and still let the +user pick their own password, call `createUser` with the `email` option +and then +call [`Accounts.sendEnrollmentEmail`](#accounts_sendenrollmentemail). This +will send the user an email with a link to set their initial password. + +By default the `profile` option is added directly to the new user document. To +override this behavior, use [`Accounts.onCreateUser`](#accounts_oncreateuser). + +This function is only used for creating users with passwords. The external +service login flows do not use this function. + + +{{> autoApiBox "Accounts.changePassword"}} + +{{> autoApiBox "Accounts.forgotPassword"}} + +This triggers a call +to [`Accounts.sendResetPasswordEmail`](#accounts_sendresetpasswordemail) +on the server. When the user visits the link in this email, the callback +registered with [`Accounts.onResetPasswordLink`](#Accounts-onResetPasswordLink) +will be called. + +If you are using the [`accounts-ui` package](#accountsui), this is handled +automatically. Otherwise, it is your responsiblity to prompt the user for the +new password and call `resetPassword`. + +{{> autoApiBox "Accounts.resetPassword"}} + +This function accepts tokens passed into the callbacks registered with +[`Accounts.onResetPasswordLink`](#Accounts-onResetPasswordLink) and +[`Accounts.onEnrollmentLink`](#Accounts-onEnrollmentLink). + +{{> autoApiBox "Accounts.setPassword"}} + +{{> autoApiBox "Accounts.verifyEmail"}} + +This function accepts tokens passed into the callback registered with +[`Accounts.onEmailVerificationLink`](#Accounts-onEmailVerificationLink). + +{{> autoApiBox "Accounts.sendResetPasswordEmail"}} + +When the user visits the link in this email, the callback registered with +[`Accounts.onResetPasswordLink`](#Accounts-onResetPasswordLink) will be called. + +To customize the contents of the email, see +[`Accounts.emailTemplates`](#accounts_emailtemplates). + +{{> autoApiBox "Accounts.sendEnrollmentEmail"}} + +When the user visits the link in this email, the callback registered with +[`Accounts.onEnrollmentLink`](#Accounts-onEnrollmentLink) will be called. + +To customize the contents of the email, see +[`Accounts.emailTemplates`](#accounts_emailtemplates). + +{{> autoApiBox "Accounts.sendVerificationEmail"}} + +When the user visits the link in this email, the callback registered with +[`Accounts.onEmailVerificationLink`](#Accounts-onEmailVerificationLink) will +be called. + +To customize the contents of the email, see +[`Accounts.emailTemplates`](#accounts_emailtemplates). + + +{{> autoApiBox "Accounts.onResetPasswordLink"}} + +{{> autoApiBox "Accounts.onEnrollmentLink"}} + +{{> autoApiBox "Accounts.onEmailVerificationLink"}} + + + + +{{> autoApiBox "Accounts.emailTemplates"}} + +This is an `Object` with several fields that are used to generate text/html +for the emails sent by `sendResetPasswordEmail`, `sendEnrollmentEmail`, +and `sendVerificationEmail`. + +Override fields of the object by assigning to them: + +- `from`: A `String` with an [RFC5322](http://tools.ietf.org/html/rfc5322) From + address. By default, the email is sent from `no-reply@meteor.com`. If you + wish to receive email from users asking for help with their account, be sure + to set this to an email address that you can receive email at. +- `siteName`: The public name of your application. Defaults to the DNS name of + the application (eg: `awesome.meteor.com`). +- `resetPassword`: An `Object` with two fields: + - `resetPassword.subject`: A `Function` that takes a user object and returns + a `String` for the subject line of a reset password email. + - `resetPassword.text`: A `Function` that takes a user object and a url, and + returns the body text for a reset password email. + - `resetPassword.html`: An optional `Function` that takes a user object and a + url, and returns the body html for a reset password email. +- `enrollAccount`: Same as `resetPassword`, but for initial password setup for + new accounts. +- `verifyEmail`: Same as `resetPassword`, but for verifying the users email + address. + + +Example: + + Accounts.emailTemplates.siteName = "AwesomeSite"; + Accounts.emailTemplates.from = "AwesomeSite Admin "; + Accounts.emailTemplates.enrollAccount.subject = function (user) { + return "Welcome to Awesome Town, " + user.profile.name; + }; + Accounts.emailTemplates.enrollAccount.text = function (user, url) { + return "You have been selected to participate in building a better future!" + + " To activate your account, simply click the link below:\n\n" + + url; + }; + +{{/template}} \ No newline at end of file diff --git a/docs/client/api/pubsub.md b/docs/client/api/pubsub.md new file mode 100644 index 0000000000..83679763e8 --- /dev/null +++ b/docs/client/api/pubsub.md @@ -0,0 +1,221 @@ +{{#template name="api_pubsub"}} + +

Publish and subscribe

+ +These functions control how Meteor servers publish sets of records and +how clients can subscribe to those sets. + +{{> autoApiBox "Meteor.publish"}} + +To publish records to clients, call `Meteor.publish` on the server with +two parameters: the name of the record set, and a *publish function* +that Meteor will call each time a client subscribes to the name. + +Publish functions can return a +[`Collection.Cursor`](#mongo_cursor), in which case Meteor +will publish that cursor's documents to each subscribed client. You can +also return an array of `Collection.Cursor`s, in which case Meteor will +publish all of the cursors. + +{{#warning}} +If you return multiple cursors in an array, they currently must all be from +different collections. We hope to lift this restriction in a future release. +{{/warning}} + + // server: publish the rooms collection, minus secret info. + Meteor.publish("rooms", function () { + return Rooms.find({}, {fields: {secretInfo: 0}}); + }); + + // ... and publish secret info for rooms where the logged-in user + // is an admin. If the client subscribes to both streams, the records + // are merged together into the same documents in the Rooms collection. + Meteor.publish("adminSecretInfo", function () { + return Rooms.find({admin: this.userId}, {fields: {secretInfo: 1}}); + }); + + // publish dependent documents and simulate joins + Meteor.publish("roomAndMessages", function (roomId) { + check(roomId, String); + return [ + Rooms.find({_id: roomId}, {fields: {secretInfo: 0}}), + Messages.find({roomId: roomId}) + ]; + }); + +Alternatively, a publish function can directly control its published record set +by calling the functions [`added`](#publish_added) (to add a new document to the +published record set), [`changed`](#publish_changed) (to change or clear some +fields on a document already in the published record set), and +[`removed`](#publish_removed) (to remove documents from the published record +set). These methods are provided by `this` in your publish function. + +If a publish function does not return a cursor or array of cursors, it is +assumed to be using the low-level `added`/`changed`/`removed` interface, and it +**must also call [`ready`](#publish_ready) once the initial record set is +complete**. + +Example: + + // server: publish the current size of a collection + Meteor.publish("counts-by-room", function (roomId) { + var self = this; + check(roomId, String); + var count = 0; + var initializing = true; + + // observeChanges only returns after the initial `added` callbacks + // have run. Until then, we don't want to send a lot of + // `self.changed()` messages - hence tracking the + // `initializing` state. + var handle = Messages.find({roomId: roomId}).observeChanges({ + added: function (id) { + count++; + if (!initializing) + self.changed("counts", roomId, {count: count}); + }, + removed: function (id) { + count--; + self.changed("counts", roomId, {count: count}); + } + // don't care about changed + }); + + // Instead, we'll send one `self.added()` message right after + // observeChanges has returned, and mark the subscription as + // ready. + initializing = false; + self.added("counts", roomId, {count: count}); + self.ready(); + + // Stop observing the cursor when client unsubs. + // Stopping a subscription automatically takes + // care of sending the client any removed messages. + self.onStop(function () { + handle.stop(); + }); + }); + + // client: declare collection to hold count object + Counts = new Mongo.Collection("counts"); + + // client: subscribe to the count for the current room + Tracker.autorun(function () { + Meteor.subscribe("counts-by-room", Session.get("roomId")); + }); + + // client: use the new collection + console.log("Current room has " + + Counts.findOne(Session.get("roomId")).count + + " messages."); + + // server: sometimes publish a query, sometimes publish nothing + Meteor.publish("secretData", function () { + if (this.userId === 'superuser') { + return SecretData.find(); + } else { + // Declare that no data is being published. If you leave this line + // out, Meteor will never consider the subscription ready because + // it thinks you're using the added/changed/removed interface where + // you have to explicitly call this.ready(). + return []; + } + }); + +Since publish functions usually expect particular types as arguments, +use [`check`](#check) liberally to ensure the arguments have +the correct [types and structure](#matchpatterns). + +{{#warning}} +Meteor will emit a warning message if you call `Meteor.publish` in a +project that includes the `autopublish` package. Your publish function +will still work. +{{/warning}} + +{{> autoApiBox "Subscription#userId"}} + +This is constant. However, if the logged-in user changes, the publish +function is rerun with the new value. + +{{> autoApiBox "Subscription#added"}} +{{> autoApiBox "Subscription#changed"}} +{{> autoApiBox "Subscription#removed"}} +{{> autoApiBox "Subscription#ready"}} +{{> autoApiBox "Subscription#onStop"}} + +If you call [`observe`](#observe) or [`observeChanges`](#observe_changes) in your +publish handler, this is the place to stop the observes. + +{{> autoApiBox "Subscription#error"}} +{{> autoApiBox "Subscription#stop"}} +{{> autoApiBox "Subscription#connection"}} + +{{> autoApiBox "Meteor.subscribe"}} + +When you subscribe to a record set, it tells the server to send records to the +client. The client stores these records in local [Minimongo +collections](#mongo_collection), with the same name as the `collection` +argument used in the publish handler's [`added`](#publish_added), +[`changed`](#publish_changed), and [`removed`](#publish_removed) +callbacks. Meteor will queue incoming records until you declare the +[`Mongo.Collection`](#mongo_collection) on the client with the matching +collection name. + + // okay to subscribe (and possibly receive data) before declaring + // the client collection that will hold it. assume "allplayers" + // publishes data from server's "players" collection. + Meteor.subscribe("allplayers"); + ... + // client queues incoming players records until ... + ... + Players = new Mongo.Collection("players"); + +The client will see a document if the document is currently in the published +record set of any of its subscriptions. + +The `onReady` callback is called with no arguments when the server +[marks the subscription as ready](#publish_ready). The `onError` callback is +called with a [`Meteor.Error`](#meteor_error) if the subscription fails or is +terminated by the server. + +`Meteor.subscribe` returns a subscription handle, which is an object with the +following methods: + +
+{{#dtdd "stop()"}} +Cancel the subscription. This will typically result in the server directing the +client to remove the subscription's data from the client's cache. +{{/dtdd}} + +{{#dtdd "ready()"}} +True if the server has [marked the subscription as ready](#publish_ready). A +reactive data source. +{{/dtdd}} +
+ +If you call `Meteor.subscribe` within a [reactive computation](#reactivity), +for example using +[`Tracker.autorun`](#tracker_autorun), the subscription will automatically be +cancelled when the computation is invalidated or stopped; it's not necessary +to call `stop` on +subscriptions made from inside `autorun`. However, if the next iteration +of your run function subscribes to the same record set (same name and +parameters), Meteor is smart enough to skip a wasteful +unsubscribe/resubscribe. For example: + + Tracker.autorun(function () { + Meteor.subscribe("chat", {room: Session.get("current-room")}); + Meteor.subscribe("privateMessages"); + }); + +This subscribes you to the chat messages in the current room and to your private +messages. When you change rooms by calling `Session.set("current-room", +"new-room")`, Meteor will subscribe to the new room's chat messages, +unsubscribe from the original room's chat messages, and continue to +stay subscribed to your private messages. + +If more than one subscription sends conflicting values for a field (same +collection name, document ID, and field name), then the value on the client will +be one of the published values, chosen arbitrarily. + +{{/template}} \ No newline at end of file diff --git a/docs/client/api/reactive-var.md b/docs/client/api/reactive-var.md new file mode 100644 index 0000000000..0b6107c349 --- /dev/null +++ b/docs/client/api/reactive-var.md @@ -0,0 +1,41 @@ +{{#template name="api_reactive_var"}} + + +

ReactiveVar

+ +To use `ReactiveVar`, add the `reactive-var` package to your project with +`$ meteor add reactive-var`. + +{{> autoApiBox "ReactiveVar"}} + +A ReactiveVar holds a single value that can be get and set, such that calling +`set` will invalidate any Computations that called `get`, according to the +usual contract for reactive data sources. + +A ReactiveVar is similar to a Session variable, with a few differences: + +* ReactiveVars don't have global names, like the "foo" in `Session.get("foo")`. + Instead, they may be created and used locally, for example attached to a + template instance, as in: `this.foo.get()`. + +* ReactiveVars are not automatically migrated across hot code pushes, + whereas Session state is. + +* ReactiveVars can hold any value, while Session variables are limited to + JSON or EJSON. + +An important property of ReactiveVars — which is sometimes a +reason for using one — is that setting the value to the same +value as before has no effect; it does not trigger any invalidations. +So if one autorun sets a ReactiveVar, and another autorun gets the +ReactiveVar, a re-run of the first autorun won't necessarily trigger +the second. By default, only primitive values are compared this way, +while calling `set` on an argument that is an *object* (not a +primitive) always counts as a change. You can configure this behavior +using the `equalsFunc` argument. + +{{> autoApiBox "ReactiveVar#get"}} + +{{> autoApiBox "ReactiveVar#set"}} + +{{/template}} \ No newline at end of file diff --git a/docs/client/api/session.md b/docs/client/api/session.md new file mode 100644 index 0000000000..317d92f872 --- /dev/null +++ b/docs/client/api/session.md @@ -0,0 +1,112 @@ +{{#template name="api_session"}} + + +

Session

+ +`Session` provides a global object on the client that you can use to +store an arbitrary set of key-value pairs. Use it to store things like +the currently selected item in a list. + +What's special about `Session` is that it's reactive. If +you call [`Session.get`](#session_get)`("currentList")` +from inside a template, the template will automatically be rerendered +whenever [`Session.set`](#session_set)`("currentList", x)` is called. + +{{> autoApiBox "Session.set"}} + +Example: + + Tracker.autorun(function () { + Meteor.subscribe("chat-history", {room: Session.get("currentRoomId")}); + }); + + // Causes the function passed to Tracker.autorun to be re-run, so + // that the chat-history subscription is moved to the room "home". + Session.set("currentRoomId", "home"); + +{{> autoApiBox "Session.setDefault"}} + +This is useful in initialization code, to avoid re-initializing a session +variable every time a new version of your app is loaded. + +{{> autoApiBox "Session.get"}} + +Example: + + // in main.html + {{lt}}template name="main"> +

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"> +
{{dstache}}title}}
+ {{lt}}/template> + + ///// in JS file + Template.postsView.helpers({ + posts: function() { + return Posts.find(); + } + }); + + Template.postItem.helpers({ + postClass: function() { + return Session.equals("selectedPost", this._id) ? + "selected" : ""; + } + }); + + Template.postItem.events({ + 'click': function() { + Session.set("selectedPost", this._id); + } + }); + + // Using Session.equals here means that when the user clicks + // on an item and changes the selection, only the newly selected + // and the newly unselected items are re-rendered. + // + // If Session.get had been used instead of Session.equals, then + // when the selection changed, all the items would be re-rendered. + +For object and array session values, you cannot use `Session.equals`; instead, +you need to use the `underscore` package and write +`_.isEqual(Session.get(key), value)`. + +{{/template}} \ No newline at end of file diff --git a/docs/client/api/templates.md b/docs/client/api/templates.md new file mode 100644 index 0000000000..3c68798e16 --- /dev/null +++ b/docs/client/api/templates.md @@ -0,0 +1,364 @@ +{{#template name="api_templates"}} + + +

Templates

+ + +When you write a template as `<{{! }}template name="foo"> ... <{{! +}}/template>` in an HTML file in your app, Meteor generates a +"template object" named `Template.foo`. + +The same template may occur many times on a page, and these +occurrences are called template instances. Template instances have a +life cycle of being created, put into the document, and later taken +out of the document and destroyed. Meteor manages these stages for +you, including determining when a template instance has been removed +or replaced and should be cleaned up. You can associate data with a +template instance, and you can access its DOM nodes when it is in the +document. + +{{> autoApiBox "Template#events"}} + +Declare event handlers for instances of this template. Multiple calls add +new event handlers in addition to the existing ones. + +See [Event Maps](#eventmaps) for a detailed description of the event +map format and how event handling works in Meteor. + +{{> autoApiBox "Template#helpers"}} + +Each template has a local dictionary of helpers that are made available to it, +and this call specifies helpers to add to the template's dictionary. + +Example: + + Template.myTemplate.helpers({ + foo: function () { + return Session.get("foo"); + } + }); + +Now you can invoke this helper with `{{dstache}}foo}}` in the template defined +with `<{{! }}template name="myTemplate">`. + +To create a helper that can be used in any template, use +[`Template.registerHelper`](#template_registerhelper). + + +{{> autoApiBox "Template#rendered"}} + +This callback is called once when an instance of Template.*myTemplate* is +rendered into DOM nodes and put into the document for the first time. + +In the body of the callback, `this` is a [template +instance](#template_inst) object that is unique to this occurrence of +the template and persists across re-renderings. Use the `created` and +`destroyed` callbacks to perform initialization or clean-up on the +object. + +Because your template has been rendered, you can use functions like +[`this.findAll`](#template_findAll) which look at its DOM nodes. + +{{> autoApiBox "Template#created"}} + +This callback is called before your template's logic is evaluated for the first +time. Inside the callback, `this` is the new [template +instance](#template_inst) object. Properties you set on this object will be +visible from the `rendered` and `destroyed` callbacks and from event handlers. + +This callback fires once and is the first callback to fire. Every +`created` has a corresponding `destroyed`; that is, if you get a +`created` callback with a certain template instance object in `this`, +you will eventually get a `destroyed` callback for the same object. + +`created` is a useful way to set up values on template instance that are +read from template helpers using `Template.instance()`. + +{{> autoApiBox "Template#destroyed"}} + +This callback is called when an occurrence of a template is taken off +the page for any reason and not replaced with a re-rendering. Inside +the callback, `this` is the [template instance](#template_inst) object +being destroyed. + +This callback is most useful for cleaning up or undoing any external effects of +`created` or `rendered`. It fires once and is the last callback to fire. + + +

Template instances

+ +A template instance object represents an occurrence of a template in +the document. It can be used to access the DOM and it can be +assigned properties that persist as the template is reactively updated. + +Template instance objects are found as the value of `this` in the +`created`, `rendered`, and `destroyed` template callbacks, and as an +argument to event handlers. You can access the current template instance +from helpers using [`Template.instance()`](#template_instance). + +In addition to the properties and functions described below, you can assign +additional properties of your choice to the object. Use the +[`created`](#template_created) and [`destroyed`](#template_destroyed) callbacks +to perform initialization or clean-up on the object. + +You can only access `findAll`, `find`, `firstNode`, and `lastNode` +from the `rendered` callback and event handlers, not from `created` +and `destroyed`, because they require the template instance to be +in the DOM. + +Template instance objects are `instanceof Blaze.TemplateInstance`. + +{{> autoApiBox "Blaze.TemplateInstance#findAll"}} + +`template.findAll` returns an array of DOM elements matching `selector`. + +{{> autoApiBox "Blaze.TemplateInstance#$"}} + +`template.$` returns a [jQuery object](http://api.jquery.com/Types/#jQuery) of +those same elements. jQuery objects are similar to arrays, with +additional methods defined by the jQuery library. + +The template instance serves as the document root for the selector. Only +elements inside the template and its sub-templates can match parts of +the selector. + +{{> autoApiBox "Blaze.TemplateInstance#find"}} + +Returns one DOM element matching `selector`, or `null` if there are no +such elements. + +The template instance serves as the document root for the selector. Only +elements inside the template and its sub-templates can match parts of +the selector. + +{{> autoApiBox "Blaze.TemplateInstance#firstNode"}} + +The two nodes `firstNode` and `lastNode` indicate the extent of the +rendered template in the DOM. The rendered template includes these +nodes, their intervening siblings, and their descendents. These two +nodes are siblings (they have the same parent), and `lastNode` comes +after `firstNode`, or else they are the same node. + +{{> autoApiBox "Blaze.TemplateInstance#lastNode"}} + +{{> autoApiBox "Blaze.TemplateInstance#data"}} + +This property provides access to the data context at the top level of +the template. It is updated each time the template is re-rendered. +Access is read-only and non-reactive. + +{{> autoApiBox "Blaze.TemplateInstance#autorun"}} + +You can use `this.autorun` from a [`created`](#template_created) or +[`rendered`](#template_rendered) callback to reactively update the DOM +or the template instance. The Computation is automatically stopped +when the template is destroyed. + +Alias for `template.view.autorun`. + +{{> autoApiBox "Blaze.TemplateInstance#view"}} + +{{> autoApiBox "Template.registerHelper"}} + +{{> autoApiBox "Template.instance"}} + +{{> autoApiBox "Template.currentData"}} + +{{> autoApiBox "Template.parentData"}} + +For example, `Template.parentData(0)` is equivalent to `Template.currentData()`. `Template.parentData(2)` +is equivalent to `{{dstache}}../..}}` in a template. + +{{> autoApiBox "Template.body"}} + +You can define helpers and event maps on `Template.body` just like on +any `Template.myTemplate` object. + +Helpers on `Template.body` are only available in the `` tags of +your app. To register a global helper, use +[Template.registerHelper](#template_registerhelper). +Event maps on `Template.body` don't apply to elements added to the + +body via `Blaze.render`, jQuery, or the DOM API, or to the body element +itself. To handle events on the body, window, or document, use jQuery +or the DOM API. + +{{> autoApiBox "Template.dynamic"}} + +`Template.dynamic` allows you to include a template by name, where the name +may be calculated by a helper and may change reactively. The `data` +argument is optional, and if it is omitted, the current data context +is used. + +For example, if there is a template named "foo", `{{dstache}}> Template.dynamic +template="foo"}}` is equivalent to `{{dstache}}> foo}}`. + +{{> apiBoxTitle name="Event Maps" id="eventmaps"}} + +An event map is an object where +the properties specify a set of events to handle, and the values are +the handlers for those events. The property can be in one of several +forms: + +
+{{#dtdd "eventtype"}} +Matches a particular type of event, such as 'click'. +{{/dtdd}} + +{{#dtdd "eventtype selector"}} +Matches a particular type of event, but only when it appears on +an element that matches a certain CSS selector. +{{/dtdd}} + +{{#dtdd "event1, event2"}} +To handle more than one type of event with the same function, use a +comma-separated list. +{{/dtdd}} +
+ +The handler function receives two arguments: `event`, an object with +information about the event, and `template`, a [template +instance](#template_inst) for the template where the handler is +defined. The handler also receives some additional context data in +`this`, depending on the context of the current element handling the +event. In a template, an element's context is the +data context where that element occurs, which is set by +block helpers such as `#with` and `#each`. + +Example: + + { + // Fires when any element is clicked + 'click': function (event) { ... }, + + // Fires when any element with the 'accept' class is clicked + 'click .accept': function (event) { ... }, + + // Fires when 'accept' is clicked or focused, or a key is pressed + 'click .accept, focus .accept, keypress': function (event) { ... } + } + +Most events bubble up the document tree from their originating +element. For example, `'click p'` catches a click anywhere in a +paragraph, even if the click originated on a link, span, or some other +element inside the paragraph. The originating element of the event +is available as the `target` property, while the element that matched +the selector and is currently handling it is called `currentTarget`. + + { + 'click p': function (event) { + var paragraph = event.currentTarget; // always a P + var clickedElement = event.target; // could be the P or a child element + } + } + +If a selector matches multiple elements that an event bubbles to, it +will be called multiple times, for example in the case of `'click +div'` or `'click *'`. If no selector is given, the handler +will only be called once, on the original target element. + +The following properties and methods are available on the event object +passed to handlers: + +
+{{#dtdd name="type" type="String"}} +The event's type, such as "click", "blur" or "keypress". +{{/dtdd}} + +{{#dtdd name="target" type="DOM Element"}} +The element that originated the event. +{{/dtdd}} + +{{#dtdd name="currentTarget" type="DOM Element"}} +The element currently handling the event. This is the element that +matched the selector in the event map. For events that bubble, it may +be `target` or an ancestor of `target`, and its value changes as the +event bubbles. +{{/dtdd}} + +{{#dtdd name="which" type="Number"}} +For mouse events, the number of the mouse button (1=left, 2=middle, 3=right). +For key events, a character or key code. +{{/dtdd}} + +{{#dtdd "stopPropagation()"}} +Prevent the event from propagating (bubbling) up to other elements. +Other event handlers matching the same element are still fired, in +this and other event maps. +{{/dtdd}} + +{{#dtdd "stopImmediatePropagation()"}} +Prevent all additional event handlers from being run on this event, +including other handlers in this event map, handlers reached by +bubbling, and handlers in other event maps. +{{/dtdd}} + +{{#dtdd "preventDefault()"}} +Prevents the action the browser would normally take in response to this +event, such as following a link or submitting a form. Further handlers +are still called, but cannot reverse the effect. +{{/dtdd}} + +{{#dtdd "isPropagationStopped()"}} +Returns whether `stopPropagation()` has been called for this event. +{{/dtdd}} + +{{#dtdd "isImmediatePropagationStopped()"}} +Returns whether `stopImmediatePropagation()` has been called for this event. +{{/dtdd}} + +{{#dtdd "isDefaultPrevented()"}} +Returns whether `preventDefault()` has been called for this event. +{{/dtdd}} +
+ +Returning `false` from a handler is the same as calling +both `stopImmediatePropagation` and `preventDefault` on the event. + +Event types and their uses include: + +
+{{#dtdd "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}} + +
+ +Other DOM events are available as well, but for the events above, +Meteor has taken some care to ensure that they work uniformly in all +browsers. + + +{{/template}} \ No newline at end of file diff --git a/docs/client/api/timers.md b/docs/client/api/timers.md new file mode 100644 index 0000000000..3443767280 --- /dev/null +++ b/docs/client/api/timers.md @@ -0,0 +1,25 @@ +{{#template name="api_timers"}} +

Timers

+ +Meteor uses global environment variables +to keep track of things like the current request's user. To make sure +these variables have the right values, you need to use +`Meteor.setTimeout` instead of `setTimeout` and `Meteor.setInterval` +instead of `setInterval`. + +These functions work just like their native JavaScript equivalents. +If you call the native function, you'll get an error stating that Meteor +code must always run within a Fiber, and advising to use +`Meteor.bindEnvironment`. + +{{> autoApiBox "Meteor.setTimeout"}} + +Returns a handle that can be used by `Meteor.clearTimeout`. + +{{> autoApiBox "Meteor.setInterval"}} + +Returns a handle that can be used by `Meteor.clearInterval`. + +{{> autoApiBox "Meteor.clearTimeout"}} +{{> autoApiBox "Meteor.clearInterval"}} +{{/template}} \ No newline at end of file diff --git a/docs/client/api/tracker.md b/docs/client/api/tracker.md new file mode 100644 index 0000000000..302b2c2e53 --- /dev/null +++ b/docs/client/api/tracker.md @@ -0,0 +1,313 @@ +{{#template name="api_tracker"}} + +

Tracker

+ +Meteor has a simple dependency tracking system which allows it to +automatically rerun templates and other computations whenever +[`Session`](#session) variables, database queries, and other data +sources change. + +Unlike most other systems, you don't have to manually declare these +dependencies — it "just works". The mechanism is simple and +efficient. When you call a function that supports reactive updates +(such as a database query), it automatically saves the current +Computation object, if any (representing, for example, the current +template being rendered). Later, when the data changes, the function +can "invalidate" the Computation, causing it to rerun (rerendering the +template). + +Applications will find [`Tracker.autorun`](#tracker_autorun) useful, while more +advanced facilities such as `Tracker.Dependency` and `onInvalidate` +callbacks are intended primarily for package authors implementing new +reactive data sources. + +To learn more about how Tracker works and to explore advanced ways to use it, +visit the Tracker chapter in the +Meteor Manual, which describes it in +complete detail. + +{{> autoApiBox "Tracker.autorun" }} + +`Tracker.autorun` allows you to run a function that depends on reactive data +sources, in such a way that if there are changes to the data later, +the function will be rerun. + +For example, you can monitor a cursor (which is a reactive data +source) and aggregate it into a session variable: + + Tracker.autorun(function () { + var oldest = _.max(Monkeys.find().fetch(), function (monkey) { + return monkey.age; + }); + if (oldest) + Session.set("oldest", oldest.name); + }); + +Or you can wait for a session variable to have a certain value, and do +something the first time it does, calling `stop` on the computation to +prevent further rerunning: + + Tracker.autorun(function (c) { + if (! Session.equals("shouldAlert", true)) + return; + + c.stop(); + alert("Oh no!"); + }); + +The function is invoked immediately, at which point it may alert and +stop right away if `shouldAlert` is already true. If not, the +function is run again when `shouldAlert` becomes true. + +A change to a data dependency does not cause an immediate rerun, but +rather "invalidates" the computation, causing it to rerun the next +time a flush occurs. A flush will occur automatically as soon as +the system is idle if there are invalidated computations. You can +also use [`Tracker.flush`](#tracker_flush) to cause an immediate flush of +all pending reruns. + +If you nest calls to `Tracker.autorun`, then when the outer call stops or +reruns, the inner call will stop automatically. Subscriptions and +observers are also automatically stopped when used as part of a +computation that is rerun, allowing new ones to be established. See +[`Meteor.subscribe`](#meteor_subscribe) for more information about +subscriptions and reactivity. + +If the initial run of an autorun throws an exception, the computation +is automatically stopped and won't be rerun. + +{{> autoApiBox "Tracker.flush" }} + +Normally, when you make changes (like writing to the database), +their impact (like updating the DOM) is delayed until the system is +idle. This keeps things predictable — you can know that the DOM +won't go changing out from under your code as it runs. It's also one +of the things that makes Meteor fast. + +`Tracker.flush` forces all of the pending reactive updates to complete. +For example, if an event handler changes a Session +variable that will cause part of the user interface to rerender, the +handler can call `flush` to perform the rerender immediately and then +access the resulting DOM. + +An automatic flush occurs whenever the system is idle which performs +exactly the same work as `Tracker.flush`. The flushing process consists +of rerunning any invalidated computations. If additional +invalidations happen while flushing, they are processed as part of the +same flush until there is no more work to be done. Callbacks +registered with [`Tracker.afterFlush`](#tracker_afterflush) are called +after processing outstanding invalidations. + +It is illegal to call `flush` from inside a `flush` or from a running +computation. + +The Meteor Manual +describes the motivation for the flush cycle and the guarantees made by +`Tracker.flush` and `Tracker.afterFlush`. + +{{> autoApiBox "Tracker.nonreactive" }} + +Calls `func` with `Tracker.currentComputation` temporarily set to `null` +and returns `func`'s own return value. If `func` accesses reactive data +sources, these data sources will never cause a rerun of the enclosing +computation. + +{{> autoApiBox "Tracker.active" }} + +This value is useful for data source implementations to determine +whether they are being accessed reactively or not. + +{{> autoApiBox "Tracker.currentComputation" }} + +It's very rare to need to access `currentComputation` directly. The +current computation is used implicitly by +[`Tracker.active`](#tracker_active) (which tests whether there is one), +[`dependency.depend()`](#dependency_depend) (which registers that it depends on a +dependency), and [`Tracker.onInvalidate`](#tracker_oninvalidate) (which +registers a callback with it). + +{{> autoApiBox "Tracker.onInvalidate" }} + +See [*`computation`*`.onInvalidate`](#computation_oninvalidate) for more +details. + +{{> autoApiBox "Tracker.afterFlush" }} + +Functions scheduled by multiple calls to `afterFlush` are guaranteed +to run in the order that `afterFlush` was called. Functions are +guaranteed to be called at a time when there are no invalidated +computations that need rerunning. This means that if an `afterFlush` +function invalidates a computation, that computation will be rerun +before any other `afterFlush` functions are called. + +

Tracker.Computation

+ +A Computation object represents code that is repeatedly rerun in +response to reactive data changes. Computations don't have return +values; they just perform actions, such as rerendering a template on +the screen. Computations are created using [`Tracker.autorun`](#tracker_autorun). +Use [`stop`](#computation_stop) to prevent further rerunning of a +computation. + +Each time a computation runs, it may access various reactive data +sources that serve as inputs to the computation, which are called its +dependencies. At some future time, one of these dependencies may +trigger the computation to be rerun by invalidating it. When this +happens, the dependencies are cleared, and the computation is +scheduled to be rerun at flush time. + +The *current computation* +([`Tracker.currentComputation`](#tracker_currentcomputation)) is the +computation that is currently being run or rerun (computed), and the +one that gains a dependency when a reactive data source is accessed. +Data sources are responsible for tracking these dependencies using +[`Tracker.Dependency`](#tracker_dependency) objects. + +Invalidating a computation sets its `invalidated` property to true +and immediately calls all of the computation's `onInvalidate` +callbacks. When a flush occurs, if the computation has been invalidated +and not stopped, then the computation is rerun by setting the +`invalidated` property to `false` and calling the original function +that was passed to `Tracker.autorun`. A flush will occur when the current +code finishes running, or sooner if `Tracker.flush` is called. + +Stopping a computation invalidates it (if it is valid) for the purpose +of calling callbacks, but ensures that it will never be rerun. + +Example: + + // if we're in a computation, then perform some clean-up + // when the current computation is invalidated (rerun or + // stopped) + if (Tracker.active) { + Tracker.onInvalidate(function () { + x.destroy(); + y.finalize(); + }); + } + +{{> autoApiBox "Tracker.Computation#stop"}} + +Stopping a computation is irreversible and guarantees that it will +never be rerun. You can stop a computation at any time, including +from the computation's own run function. Stopping a computation that +is already stopped has no effect. + +Stopping a computation causes its `onInvalidate` callbacks to run +immediately if it is not currently invalidated. + +Nested computations are stopped automatically when their enclosing +computation is rerun. + +{{> autoApiBox "Tracker.Computation#invalidate" }} + +Invalidating a computation marks it to be rerun at +[flush time](#tracker_flush), at +which point the computation becomes valid again. It is rare to +invalidate a computation manually, because reactive data sources +invalidate their calling computations when they change. Reactive data +sources in turn perform this invalidation using one or more +[`Tracker.Dependency`](#tracker_dependency) objects. + +Invalidating a computation immediately calls all `onInvalidate` +callbacks registered on it. Invalidating a computation that is +currently invalidated or is stopped has no effect. A computation can +invalidate itself, but if it continues to do so indefinitely, the +result will be an infinite loop. + +{{> autoApiBox "Tracker.Computation#onInvalidate" }} + +`onInvalidate` registers a one-time callback that either fires +immediately or as soon as the computation is next invalidated or +stopped. It is used by reactive data sources to clean up resources or +break dependencies when a computation is rerun or stopped. + +To get a callback after a computation has been recomputed, you can +call [`Tracker.afterFlush`](#tracker_afterflush) from `onInvalidate`. + +{{> autoApiBox "Tracker.Computation#stopped" }} + +{{> autoApiBox "Tracker.Computation#invalidated" }} + +This property is initially false. It is set to true by `stop()` and +`invalidate()`. It is reset to false when the computation is +recomputed at flush time. + +{{> autoApiBox "Tracker.Computation#firstRun" }} + +This property is a convenience to support the common pattern where a +computation has logic specific to the first run. + +

Tracker.Dependency

+ +A Dependency represents an atomic unit of reactive data that a +computation might depend on. Reactive data sources such as Session or +Minimongo internally create different Dependency objects for different +pieces of data, each of which may be depended on by multiple +computations. When the data changes, the computations are +invalidated. + +Dependencies don't store data, they just track the set of computations to +invalidate if something changes. Typically, a data value will be +accompanied by a Dependency object that tracks the computations that depend +on it, as in this example: + + var weather = "sunny"; + var weatherDep = new Tracker.Dependency; + + var getWeather = function () { + weatherDep.depend() + return weather; + }; + + var setWeather = function (w) { + weather = w; + // (could add logic here to only call changed() + // if the new value is different from the old) + weatherDep.changed(); + }; + +This example implements a weather data source with a simple getter and +setter. The getter records that the current computation depends on +the `weatherDep` dependency using `depend()`, while the setter +signals the dependency to invalidate all dependent computations by +calling `changed()`. + +The reason Dependencies do not store data themselves is that it can be +useful to associate multiple Dependencies with the same piece of data. +For example, one Dependency might represent the result of a database +query, while another might represent just the number of documents in +the result. A Dependency could represent whether the weather is sunny +or not, or whether the temperature is above freezing. +[`Session.equals`](#session_equals) is implemented this way for +efficiency. When you call `Session.equals("weather", "sunny")`, the +current computation is made to depend on an internal Dependency that +does not change if the weather goes from, say, "rainy" to "cloudy". + +Conceptually, the only two things a Dependency can do are gain a +dependent and change. + +A Dependency's dependent computations are always valid (they have +`invalidated === false`). If a dependent is invalidated at any time, +either by the Dependency itself or some other way, it is immediately +removed. + +See the +Meteor Manual to learn how to create a reactive data source using + Tracker.Dependency. + +{{> autoApiBox "Tracker.Dependency#changed" }} + +{{> autoApiBox "Tracker.Dependency#depend" }} + +`dep.depend()` is used in reactive data source implementations to record +the fact that `dep` is being accessed from the current computation. + +{{> autoApiBox "Tracker.Dependency#hasDependents" }} + +For reactive data sources that create many internal Dependencies, +this function is useful to determine whether a particular Dependency is +still tracking any dependency relationships or if it can be cleaned up +to save memory. + +{{/template}} \ No newline at end of file diff --git a/docs/client/commandline.html b/docs/client/commandline.html index 1f5dbf437d..e3963a0e86 100644 --- a/docs/client/commandline.html +++ b/docs/client/commandline.html @@ -149,7 +149,7 @@ can add multiple packages with one command Optionally, adds version constraints. Running `meteor add package@1.1.0` will add the package at version `1.1.0` or higher (but not `2.0.0` or higher). If you want to use version `1.1.0` exactly, use `meteor add package@=1.1.0`. You can also -'or' constraints together: for example, '=1.0.0 || =2.0.1' means either 1.0.0 (exactly) +'or' constraints together: for example, `meteor add 'package@=1.0.0 || =2.0.1'` means either 1.0.0 (exactly) or 2.0.1 (exactly). To remove a version constraint for a specific package, run `meteor add` again diff --git a/docs/client/concepts.html b/docs/client/concepts.html index 97eec1d066..8eb869c03f 100644 --- a/docs/client/concepts.html +++ b/docs/client/concepts.html @@ -89,7 +89,7 @@ server code but not served to the client, like private data files. There are more assets to consider on the client side. Meteor gathers all JavaScript files in your tree, with the exception of -the `server`, `public`, and `private` subdirectories, for the +the `server`, `tests`, `public`, and `private` subdirectories, for the client. It minifies this bundle and serves it to each new client. You're free to use a single JavaScript file for your entire application, or create a nested tree of separate files, or anything in between. @@ -100,7 +100,7 @@ executed without being wrapped in a new variable scope. This means that each top-level `var` defines a global variable. In addition, these files are executed before other client-side JavaScript files. -Files outside the `client`, `server` and `tests` subdirectories are loaded on +Files outside the `client`, `server`, `tests`, `public` and `private` subdirectories are loaded on both the client and the server! That's the place for model definitions and other functions. Meteor provides the variables [`isClient`](#meteor_isclient) and [`isServer`](#meteor_isserver) so that your code can alter its behavior depending @@ -427,7 +427,7 @@ Meteor templates when compiled. {{#note}} Today, the only templating system that ships with Meteor is Spacebars, though our community has created packages for other languages such as - [Jade](https://atmospherejs.com/package/jade). + [Jade](https://atmospherejs.com/mquandalle/jade). {{/note}} To define templates, create a file in your project with the `.html` @@ -793,9 +793,10 @@ things). However, we will still write the new versions.json file. Meteor uses extended semver versioning for its packages: that means that the version number has three parts separated by dots: major version, minor version and patch version -(for example: 1.2.3) with an optional pre-release version. You can read more about it here -(www.semver.org). Additionally, because some meteor packages wrap external libraries, -Meteor supports the convention of using _ to denote a wrap number. +(for example: 1.2.3) with an optional pre-release version. You can read more about it on +[semver.org](http://www.semver.org). +Additionally, because some meteor packages wrap external libraries, +Meteor supports the convention of using `_` to denote a wrap number. You can read more about [`package.js`](#packagejs) files in the API section. diff --git a/docs/client/data.js b/docs/client/data.js index b0c497ac88..66fc3edf85 100644 --- a/docs/client/data.js +++ b/docs/client/data.js @@ -1,2 +1,2 @@ -// This file is automatically generated by JSDoc; -DocsData = {"Accounts":{"kind":"namespace","name":"Accounts","summary":"The namespace for all accounts-related methods.","longname":"Accounts","ui":{"summary":"Accounts UI","kind":"namespace","memberof":"Accounts","name":"ui","longname":"Accounts.ui","scope":"static","config":{"summary":"Configure the behavior of [`{{> loginButtons}}`](#accountsui).","params":[{"type":{"names":["Object"]},"name":"options"}],"name":"config","longname":"Accounts.ui.config","kind":"function","memberof":"Accounts.ui","scope":"static","options":[{"type":{"names":["Object"]},"description":"

Which permissions to request from the user for each external service.

","name":"requestPermissions"},{"type":{"names":["Object"]},"description":"

To ask the user for permission to act on their behalf when offline, map the relevant external service to true. Currently only supported with Google. See Meteor.loginWithExternalService for more details.

","name":"requestOfflineToken"},{"type":{"names":["Boolean"]},"description":"

If true, forces the user to approve the app's permissions, even if previously approved. Currently only supported with Google.

","name":"forceApprovalPrompt"},{"type":{"names":["String"]},"description":"

Which fields to display in the user creation form. One of 'USERNAME_AND_EMAIL', 'USERNAME_AND_OPTIONAL_EMAIL', 'USERNAME_ONLY', or 'EMAIL_ONLY' (default).

","name":"passwordSignupFields"}],"locus":"Client"}},"emailTemplates":{"summary":"Options to customize emails sent from the Accounts system.","name":"emailTemplates","longname":"Accounts.emailTemplates","kind":"member","memberof":"Accounts","scope":"static","locus":"Anywhere"},"config":{"summary":"Set global accounts options.","params":[{"type":{"names":["Object"]},"name":"options"}],"name":"config","longname":"Accounts.config","kind":"function","memberof":"Accounts","scope":"static","options":[{"type":{"names":["Boolean"]},"description":"

New users with an email address will receive an address verification email.

","name":"sendVerificationEmail"},{"type":{"names":["Boolean"]},"description":"

Calls to createUser from the client will be rejected. In addition, if you are using accounts-ui, the "Create account" link will not be available.

","name":"forbidClientAccountCreation"},{"type":{"names":["String","function"]},"description":"

If set to a string, only allows new users if the domain part of their email address matches the string. If set to a function, only allows new users if the function returns true. The function is passed the full email address of the proposed new user. Works with password-based sign-in and external services that expose email addresses (Google, Facebook, GitHub). All existing users still can log in after enabling this option. Example: Accounts.config({ restrictCreationByEmailDomain: 'school.edu' }).

","name":"restrictCreationByEmailDomain"},{"type":{"names":["Number"]},"description":"

The number of days from when a user logs in until their token expires and they are logged out. Defaults to 90. Set to null to disable login expiration.

","name":"loginExpirationInDays"},{"type":{"names":["String"]},"description":"

When using the oauth-encryption package, the 16 byte key using to encrypt sensitive account credentials in the database, encoded in base64. This option may only be specifed on the server. See packages/oauth-encryption/README.md for details.

","name":"oauthSecretKey"}],"locus":"Anywhere"},"validateLoginAttempt":{"summary":"Validate login attempts.","params":[{"type":{"names":["function"]},"description":"

Called whenever a login is attempted (either successful or unsuccessful). A login can be aborted by returning a falsy value or throwing an exception.

","name":"func"}],"name":"validateLoginAttempt","longname":"Accounts.validateLoginAttempt","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Server"},"onLogin":{"summary":"Register a callback to be called after a login attempt succeeds.","params":[{"type":{"names":["function"]},"description":"

The callback to be called when login is successful.

","name":"func"}],"name":"onLogin","longname":"Accounts.onLogin","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Server"},"onLoginFailure":{"summary":"Register a callback to be called after a login attempt fails.","params":[{"type":{"names":["function"]},"description":"

The callback to be called after the login has failed.

","name":"func"}],"name":"onLoginFailure","longname":"Accounts.onLoginFailure","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Server"},"onCreateUser":{"summary":"Customize new user creation.","params":[{"type":{"names":["function"]},"description":"

Called whenever a new user is created. Return the new user object, or throw an Error to abort the creation.

","name":"func"}],"name":"onCreateUser","longname":"Accounts.onCreateUser","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Server"},"validateNewUser":{"summary":"Set restrictions on new user creation.","params":[{"type":{"names":["function"]},"description":"

Called whenever a new user is created. Takes the new user object, and returns true to allow the creation or false to abort.

","name":"func"}],"name":"validateNewUser","longname":"Accounts.validateNewUser","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Server"},"onResetPasswordLink":{"summary":"Register a function to call when a reset password link is clicked\nin an email sent by\n[`Accounts.sendResetPasswordEmail`](#accounts_sendresetpasswordemail).\nThis function should be called in top-level code, not inside\n`Meteor.startup()`.","params":[{"type":{"names":["function"]},"description":"

The function to call. It is given two arguments:

\n
    \n
  1. token: A password reset token that can be passed to\nAccounts.resetPassword.
  2. \n
  3. done: A function to call when the password reset UI flow is complete. The normal\nlogin process is suspended until this function is called, so that the\npassword for user A can be reset even if user B was logged in.
  4. \n
","name":"callback"}],"name":"onResetPasswordLink","longname":"Accounts.onResetPasswordLink","kind":"function","memberof":"Accounts","scope":"static","options":[]},"onEmailVerificationLink":{"summary":"Register a function to call when an email verification link is\nclicked in an email sent by\n[`Accounts.sendVerificationEmail`](#accounts_sendverificationemail).\nThis function should be called in top-level code, not inside\n`Meteor.startup()`.","params":[{"type":{"names":["function"]},"description":"

The function to call. It is given two arguments:

\n
    \n
  1. token: An email verification token that can be passed to\nAccounts.verifyEmail.
  2. \n
  3. done: A function to call when the email verification UI flow is complete.\nThe normal login process is suspended until this function is called, so\nthat the user can be notified that they are verifying their email before\nbeing logged in.
  4. \n
","name":"callback"}],"name":"onEmailVerificationLink","longname":"Accounts.onEmailVerificationLink","kind":"function","memberof":"Accounts","scope":"static","options":[]},"onEnrollmentLink":{"summary":"Register a function to call when an account enrollment link is\nclicked in an email sent by\n[`Accounts.sendEnrollmentEmail`](#accounts_sendenrollmentemail).\nThis function should be called in top-level code, not inside\n`Meteor.startup()`.","params":[{"type":{"names":["function"]},"description":"

The function to call. It is given two arguments:

\n
    \n
  1. token: A password reset token that can be passed to\nAccounts.resetPassword to give the newly\nenrolled account a password.
  2. \n
  3. done: A function to call when the enrollment UI flow is complete.\nThe normal login process is suspended until this function is called, so that\nuser A can be enrolled even if user B was logged in.
  4. \n
","name":"callback"}],"name":"onEnrollmentLink","longname":"Accounts.onEnrollmentLink","kind":"function","memberof":"Accounts","scope":"static","options":[]},"createUser":{"summary":"Create a new user.","params":[{"type":{"names":["Object"]},"name":"options"},{"type":{"names":["function"]},"optional":true,"description":"

Client only, optional callback. Called with no arguments on success, or with a single Error argument on failure.

","name":"callback"}],"name":"createUser","longname":"Accounts.createUser","kind":"function","memberof":"Accounts","scope":"static","options":[{"type":{"names":["String"]},"description":"

A unique name for this user.

","name":"username"},{"type":{"names":["String"]},"description":"

The user's email address.

","name":"email"},{"type":{"names":["String"]},"description":"

The user's password. This is not sent in plain text over the wire.

","name":"password"},{"type":{"names":["Object"]},"description":"

The user's profile, typically including the name field.

","name":"profile"}],"locus":"Anywhere"},"changePassword":{"summary":"Change the current user's password. Must be logged in.","params":[{"type":{"names":["String"]},"description":"

The user's current password. This is not sent in plain text over the wire.

","name":"oldPassword"},{"type":{"names":["String"]},"description":"

A new password for the user. This is not sent in plain text over the wire.

","name":"newPassword"},{"type":{"names":["function"]},"optional":true,"description":"

Optional callback. Called with no arguments on success, or with a single Error argument on failure.

","name":"callback"}],"name":"changePassword","longname":"Accounts.changePassword","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Client"},"forgotPassword":{"summary":"Request a forgot password email.","params":[{"type":{"names":["Object"]},"name":"options"},{"type":{"names":["function"]},"optional":true,"description":"

Optional callback. Called with no arguments on success, or with a single Error argument on failure.

","name":"callback"}],"name":"forgotPassword","longname":"Accounts.forgotPassword","kind":"function","memberof":"Accounts","scope":"static","options":[{"type":{"names":["String"]},"description":"

The email address to send a password reset link.

","name":"email"}],"locus":"Client"},"resetPassword":{"summary":"Reset the password for a user using a token received in email. Logs the user in afterwards.","params":[{"type":{"names":["String"]},"description":"

The token retrieved from the reset password URL.

","name":"token"},{"type":{"names":["String"]},"description":"

A new password for the user. This is not sent in plain text over the wire.

","name":"newPassword"},{"type":{"names":["function"]},"optional":true,"description":"

Optional callback. Called with no arguments on success, or with a single Error argument on failure.

","name":"callback"}],"name":"resetPassword","longname":"Accounts.resetPassword","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Client"},"verifyEmail":{"summary":"Marks the user's email address as verified. Logs the user in afterwards.","params":[{"type":{"names":["String"]},"description":"

The token retrieved from the verification URL.

","name":"token"},{"type":{"names":["function"]},"optional":true,"description":"

Optional callback. Called with no arguments on success, or with a single Error argument on failure.

","name":"callback"}],"name":"verifyEmail","longname":"Accounts.verifyEmail","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Client"},"setPassword":{"summary":"Forcibly change the password for a user.","params":[{"type":{"names":["String"]},"description":"

The id of the user to update.

","name":"userId"},{"type":{"names":["String"]},"description":"

A new password for the user.

","name":"newPassword"}],"name":"setPassword","longname":"Accounts.setPassword","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Server"},"sendResetPasswordEmail":{"summary":"Send an email with a link the user can use to reset their password.","params":[{"type":{"names":["String"]},"description":"

The id of the user to send email to.

","name":"userId"},{"type":{"names":["String"]},"optional":true,"description":"

Optional. Which address of the user's to send the email to. This address must be in the user's emails list. Defaults to the first email in the list.

","name":"email"}],"name":"sendResetPasswordEmail","longname":"Accounts.sendResetPasswordEmail","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Server"},"sendEnrollmentEmail":{"summary":"Send an email with a link the user can use to set their initial password.","params":[{"type":{"names":["String"]},"description":"

The id of the user to send email to.

","name":"userId"},{"type":{"names":["String"]},"optional":true,"description":"

Optional. Which address of the user's to send the email to. This address must be in the user's emails list. Defaults to the first email in the list.

","name":"email"}],"name":"sendEnrollmentEmail","longname":"Accounts.sendEnrollmentEmail","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Server"},"sendVerificationEmail":{"summary":"Send an email with a link the user can use verify their email address.","params":[{"type":{"names":["String"]},"description":"

The id of the user to send email to.

","name":"userId"},{"type":{"names":["String"]},"optional":true,"description":"

Optional. Which address of the user's to send the email to. This address must be in the user's emails list. Defaults to the first unverified email in the list.

","name":"email"}],"name":"sendVerificationEmail","longname":"Accounts.sendVerificationEmail","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Server"}},"EJSON":{"kind":"namespace","summary":"Namespace for EJSON functions","name":"EJSON","longname":"EJSON","scope":"global","newBinary":{"summary":"Allocate a new buffer of binary data that EJSON can serialize.","params":[{"type":{"names":["Number"]},"description":"

The number of bytes of binary data to allocate.

","name":"size"}],"name":"newBinary","longname":"EJSON.newBinary","kind":"member","memberof":"EJSON","scope":"static","locus":"Anywhere"},"CustomType#typeName":{"kind":"function","name":"typeName","memberof":"EJSON.CustomType","summary":"Return the tag used to identify this type. This must match the tag used to register this type with [`EJSON.addType`](#ejson_add_type).","scope":"instance","longname":"EJSON.CustomType#typeName","options":[],"params":[],"locus":"Anywhere"},"CustomType#toJSONValue":{"kind":"function","name":"toJSONValue","memberof":"EJSON.CustomType","summary":"Serialize this instance into a JSON-compatible value.","scope":"instance","longname":"EJSON.CustomType#toJSONValue","options":[],"params":[],"locus":"Anywhere"},"CustomType#clone":{"kind":"function","name":"clone","memberof":"EJSON.CustomType","summary":"Return a value `r` such that `this.equals(r)` is true, and modifications to `r` do not affect `this` and vice versa.","scope":"instance","longname":"EJSON.CustomType#clone","options":[],"params":[],"locus":"Anywhere"},"CustomType#equals":{"kind":"function","name":"equals","memberof":"EJSON.CustomType","summary":"Return `true` if `other` has a value equal to `this`; `false` otherwise.","params":[{"type":{"names":["Object"]},"description":"

Another object to compare this to.

","name":"other"}],"scope":"instance","longname":"EJSON.CustomType#equals","options":[],"locus":"Anywhere"},"addType":{"summary":"Add a custom datatype to EJSON.","params":[{"type":{"names":["String"]},"description":"

A tag for your custom type; must be unique among custom data types defined in your project, and must match the result of your type's typeName method.

","name":"name"},{"type":{"names":["function"]},"description":"

A function that deserializes a JSON-compatible value into an instance of your type. This should match the serialization performed by your type's toJSONValue method.

","name":"factory"}],"name":"addType","longname":"EJSON.addType","kind":"function","memberof":"EJSON","scope":"static","options":[],"locus":"Anywhere"},"toJSONValue":{"summary":"Serialize an EJSON-compatible value into its plain JSON representation.","params":[{"type":{"names":["EJSON"]},"description":"

A value to serialize to plain JSON.

","name":"val"}],"name":"toJSONValue","longname":"EJSON.toJSONValue","kind":"function","memberof":"EJSON","scope":"static","options":[],"locus":"Anywhere"},"fromJSONValue":{"summary":"Deserialize an EJSON value from its plain JSON representation.","params":[{"type":{"names":["JSONCompatible"]},"description":"

A value to deserialize into EJSON.

","name":"val"}],"name":"fromJSONValue","longname":"EJSON.fromJSONValue","kind":"function","memberof":"EJSON","scope":"static","options":[],"locus":"Anywhere"},"stringify":{"summary":"Serialize a value to a string.\n\nFor EJSON values, the serialization fully represents the value. For non-EJSON values, serializes the same way as `JSON.stringify`.","params":[{"type":{"names":["EJSON"]},"description":"

A value to stringify.

","name":"val"},{"type":{"names":["Object"]},"optional":true,"name":"options"}],"name":"stringify","longname":"EJSON.stringify","kind":"function","memberof":"EJSON","scope":"static","options":[{"type":{"names":["Boolean","Integer","String"]},"description":"

Indents objects and arrays for easy readability. When true, indents by 2 spaces; when an integer, indents by that number of spaces; and when a string, uses the string as the indentation pattern.

","name":"indent"},{"type":{"names":["Boolean"]},"description":"

When true, stringifies keys in an object in sorted order.

","name":"canonical"}],"locus":"Anywhere"},"parse":{"summary":"Parse a string into an EJSON value. Throws an error if the string is not valid EJSON.","params":[{"type":{"names":["String"]},"description":"

A string to parse into an EJSON value.

","name":"str"}],"name":"parse","longname":"EJSON.parse","kind":"function","memberof":"EJSON","scope":"static","options":[],"locus":"Anywhere"},"isBinary":{"summary":"Returns true if `x` is a buffer of binary data, as returned from [`EJSON.newBinary`](#ejson_new_binary).","params":[{"type":{"names":["Object"]},"description":"

The variable to check.

","name":"x"}],"name":"isBinary","longname":"EJSON.isBinary","kind":"function","memberof":"EJSON","scope":"static","options":[],"locus":"Anywhere"},"equals":{"summary":"Return true if `a` and `b` are equal to each other. Return false otherwise. Uses the `equals` method on `a` if present, otherwise performs a deep comparison.","params":[{"type":{"names":["EJSON"]},"name":"a"},{"type":{"names":["EJSON"]},"name":"b"},{"type":{"names":["Object"]},"optional":true,"name":"options"}],"name":"equals","longname":"EJSON.equals","kind":"function","memberof":"EJSON","scope":"static","options":[{"type":{"names":["Boolean"]},"description":"

Compare in key sensitive order, if supported by the JavaScript implementation. For example, {a: 1, b: 2} is equal to {b: 2, a: 1} only when keyOrderSensitive is false. The default is false.

","name":"keyOrderSensitive"}],"locus":"Anywhere"},"clone":{"summary":"Return a deep copy of `val`.","params":[{"type":{"names":["EJSON"]},"description":"

A value to copy.

","name":"val"}],"name":"clone","longname":"EJSON.clone","kind":"function","memberof":"EJSON","scope":"static","options":[],"locus":"Anywhere"},"CustomType":{"kind":"class","name":"CustomType","memberof":"EJSON","summary":"The interface that a class must satisfy to be able to become an\nEJSON custom type via EJSON.addType.","scope":"static","longname":"EJSON.CustomType","options":[],"params":[],"instancename":"customType"}},"Meteor":{"summary":"The Meteor namespace","kind":"namespace","name":"Meteor","longname":"Meteor","users":{"summary":"A [Mongo.Collection](#collections) containing user documents.","name":"users","longname":"Meteor.users","kind":"member","memberof":"Meteor","scope":"static","locus":"Anywhere"},"isClient":{"summary":"Boolean variable. True if running in client environment.","scope":"static","name":"isClient","longname":"Meteor.isClient","kind":"member","memberof":"Meteor","locus":"Anywhere"},"isServer":{"summary":"Boolean variable. True if running in server environment.","scope":"static","name":"isServer","longname":"Meteor.isServer","kind":"member","memberof":"Meteor","locus":"Anywhere"},"settings":{"summary":"`Meteor.settings` contains deployment-specific configuration options. You can initialize settings by passing the `--settings` option (which takes the name of a file containing JSON data) to `meteor run` or `meteor deploy`. When running your server directly (e.g. from a bundle), you instead specify settings by putting the JSON directly into the `METEOR_SETTINGS` environment variable. If you don't provide any settings, `Meteor.settings` will be an empty object. If the settings object contains a key named `public`, then `Meteor.settings.public` will be available on the client as well as the server. All other properties of `Meteor.settings` are only defined on the server.","name":"settings","longname":"Meteor.settings","kind":"member","memberof":"Meteor","scope":"static","locus":"Anywhere"},"isCordova":{"summary":"Boolean variable. True if running in a Cordova mobile environment.","name":"isCordova","longname":"Meteor.isCordova","kind":"member","memberof":"Meteor","scope":"static","locus":"Anywhere"},"release":{"summary":"`Meteor.release` is a string containing the name of the [release](#meteorupdate) with which the project was built (for example, `\"1.2.3\"`). It is `undefined` if the project was built using a git checkout of Meteor.","name":"release","longname":"Meteor.release","kind":"member","memberof":"Meteor","scope":"static","locus":"Anywhere"},"userId":{"summary":"Get the current user id, or `null` if no user is logged in. A reactive data source.","name":"userId","longname":"Meteor.userId","kind":"function","memberof":"Meteor","scope":"static","options":[],"params":[],"locus":"Anywhere but publish functions"},"loggingIn":{"summary":"True if a login method (such as `Meteor.loginWithPassword`, `Meteor.loginWithFacebook`, or `Accounts.createUser`) is currently in progress. A reactive data source.","name":"loggingIn","longname":"Meteor.loggingIn","kind":"function","memberof":"Meteor","scope":"static","options":[],"params":[],"locus":"Client"},"user":{"summary":"Get the current user record, or `null` if no user is logged in. A reactive data source.","name":"user","longname":"Meteor.user","kind":"function","memberof":"Meteor","scope":"static","options":[],"params":[],"locus":"Anywhere but publish functions"},"logout":{"summary":"Log the user out.","params":[{"type":{"names":["function"]},"optional":true,"description":"

Optional callback. Called with no arguments on success, or with a single Error argument on failure.

","name":"callback"}],"name":"logout","longname":"Meteor.logout","kind":"function","memberof":"Meteor","scope":"static","options":[],"locus":"Client"},"logoutOtherClients":{"summary":"Log out other clients logged in as the current user, but does not log out the client that calls this function.","params":[{"type":{"names":["function"]},"optional":true,"description":"

Optional callback. Called with no arguments on success, or with a single Error argument on failure.

","name":"callback"}],"name":"logoutOtherClients","longname":"Meteor.logoutOtherClients","kind":"function","memberof":"Meteor","scope":"static","options":[],"locus":"Client"},"loginWith":{"name":"loginWith","memberof":"Meteor","kind":"function","summary":"Log the user in using an external service.","params":[{"type":{"names":["Object"]},"optional":true,"name":"options"},{"type":{"names":["function"]},"optional":true,"description":"

Optional callback. Called with no arguments on success, or with a single Error argument on failure.

","name":"callback"}],"scope":"static","longname":"Meteor.loginWith","options":[{"type":{"names":["Array."]},"description":"

A list of permissions to request from the user.

","name":"requestPermissions"},{"type":{"names":["Boolean"]},"description":"

If true, asks the user for permission to act on their behalf when offline. This stores an additional offline token in the services field of the user document. Currently only supported with Google.

","name":"requestOfflineToken"},{"type":{"names":["Boolean"]},"description":"

If true, forces the user to approve the app's permissions, even if previously approved. Currently only supported with Google.

","name":"forceApprovalPrompt"},{"type":{"names":["String"]},"description":"

An email address that the external service will use to pre-fill the login prompt. Currently only supported with Meteor developer accounts.

","name":"userEmail"},{"type":{"names":["String"]},"description":"

Login style ("popup" or "redirect", defaults to the login service configuration). The "popup" style opens the login page in a separate popup window, which is generally preferred because the Meteor application doesn't need to be reloaded. The "redirect" style redirects the Meteor application's window to the login page, and the login service provider redirects back to the Meteor application which is then reloaded. The "redirect" style can be used in situations where a popup window can't be opened, such as in a mobile UIWebView. The "redirect" style however relies on session storage which isn't available in Safari private mode, so the "popup" style will be forced if session storage can't be used.

","name":"loginStyle"}],"locus":"Client"},"loginWithPassword":{"summary":"Log the user in with a password.","params":[{"type":{"names":["Object","String"]},"description":"

Either a string interpreted as a username or an email; or an object with a single key: email, username or id.

","name":"user"},{"type":{"names":["String"]},"description":"

The user's password.

","name":"password"},{"type":{"names":["function"]},"optional":true,"description":"

Optional callback. Called with no arguments on success, or with a single Error argument on failure.

","name":"callback"}],"name":"loginWithPassword","longname":"Meteor.loginWithPassword","kind":"function","memberof":"Meteor","scope":"static","options":[],"locus":"Client"},"subscribe":{"memberof":"Meteor","summary":"Subscribe to a record set. Returns a handle that provides `stop()` and `ready()` methods.","params":[{"type":{"names":["String"]},"description":"

Name of the subscription. Matches the name of the server's publish() call.

","name":"name"},{"type":{"names":["Any"]},"optional":true,"description":"

Optional arguments passed to publisher function on server.

","name":"arg1, arg2..."},{"type":{"names":["function","Object"]},"optional":true,"description":"

Optional. May include onError and onReady callbacks. If a function is passed instead of an object, it is interpreted as an onReady callback.

","name":"callbacks"}],"name":"subscribe","longname":"Meteor.subscribe","kind":"function","scope":"static","options":[],"locus":"Client"},"call":{"memberof":"Meteor","summary":"Invokes a method passing any number of arguments.","params":[{"type":{"names":["String"]},"description":"

Name of method to invoke

","name":"name"},{"type":{"names":["EJSONable"]},"optional":true,"description":"

Optional method arguments

","name":"arg1, arg2..."},{"type":{"names":["function"]},"optional":true,"description":"

Optional callback, which is called asynchronously with the error or result after the method is complete. If not provided, the method runs synchronously if possible (see below).

","name":"asyncCallback"}],"name":"call","longname":"Meteor.call","kind":"function","scope":"static","options":[],"locus":"Anywhere"},"apply":{"memberof":"Meteor","summary":"Invoke a method passing an array of arguments.","params":[{"type":{"names":["String"]},"description":"

Name of method to invoke

","name":"name"},{"type":{"names":["Array."]},"description":"

Method arguments

","name":"args"},{"type":{"names":["Object"]},"optional":true,"name":"options"},{"type":{"names":["function"]},"optional":true,"description":"

Optional callback; same semantics as in Meteor.call.

","name":"asyncCallback"}],"name":"apply","longname":"Meteor.apply","kind":"function","scope":"static","options":[{"type":{"names":["Boolean"]},"description":"

(Client only) If true, don't send this method until all previous method calls have completed, and don't send any subsequent method calls until this one is completed.

","name":"wait"},{"type":{"names":["function"]},"description":"

(Client only) This callback is invoked with the error or result of the method (just like asyncCallback) as soon as the error or result is available. The local cache may not yet reflect the writes performed by the method.

","name":"onResultReceived"}],"locus":"Anywhere"},"status":{"summary":"Get the current connection status. A reactive data source.","memberof":"Meteor","name":"status","longname":"Meteor.status","kind":"function","scope":"static","options":[],"params":[],"locus":"Client"},"reconnect":{"summary":"Force an immediate reconnection attempt if the client is not connected to the server.\n\n This method does nothing if the client is already connected.","memberof":"Meteor","name":"reconnect","longname":"Meteor.reconnect","kind":"function","scope":"static","options":[],"params":[],"locus":"Client"},"disconnect":{"summary":"Disconnect the client from the server.","memberof":"Meteor","name":"disconnect","longname":"Meteor.disconnect","kind":"function","scope":"static","options":[],"params":[],"locus":"Client"},"onConnection":{"summary":"Register a callback to be called when a new DDP connection is made to the server.","params":[{"type":{"names":["function"]},"description":"

The function to call when a new DDP connection is established.

","name":"callback"}],"memberof":"Meteor","name":"onConnection","longname":"Meteor.onConnection","kind":"function","scope":"static","options":[],"locus":"Server"},"publish":{"summary":"Publish a record set.","memberof":"Meteor","params":[{"type":{"names":["String"]},"description":"

Name of the record set. If null, the set has no name, and the record set is automatically sent to all connected clients.

","name":"name"},{"type":{"names":["function"]},"description":"

Function called on the server each time a client subscribes. Inside the function, this is the publish handler object, described below. If the client passed arguments to subscribe, the function is called with the same arguments.

","name":"func"}],"name":"publish","longname":"Meteor.publish","kind":"function","scope":"static","options":[],"locus":"Server"},"methods":{"summary":"Defines functions that can be invoked over the network by clients.","params":[{"type":{"names":["Object"]},"description":"

Dictionary whose keys are method names and values are functions.

","name":"methods"}],"memberof":"Meteor","name":"methods","longname":"Meteor.methods","kind":"function","scope":"static","options":[],"locus":"Anywhere"},"wrapAsync":{"memberof":"Meteor","summary":"Wrap a function that takes a callback function as its final parameter. On the server, the wrapped function can be used either synchronously (without passing a callback) or asynchronously (when a callback is passed). On the client, a callback is always required; errors will be logged if there is no callback. If a callback is provided, the environment captured when the original function was called will be restored in the callback.","params":[{"type":{"names":["function"]},"description":"

A function that takes a callback as its final parameter

","name":"func"},{"type":{"names":["Object"]},"optional":true,"description":"

Optional this object against which the original function will be invoked

","name":"context"}],"name":"wrapAsync","longname":"Meteor.wrapAsync","kind":"function","scope":"static","options":[],"locus":"Anywhere"},"startup":{"summary":"Run code when a client or a server starts.","params":[{"type":{"names":["function"]},"description":"

A function to run on startup.

","name":"func"}],"name":"startup","longname":"Meteor.startup","kind":"function","memberof":"Meteor","scope":"static","options":[],"locus":"Anywhere"},"setTimeout":{"memberof":"Meteor","summary":"Call a function in the future after waiting for a specified delay.","params":[{"type":{"names":["function"]},"description":"

The function to run

","name":"func"},{"type":{"names":["Number"]},"description":"

Number of milliseconds to wait before calling function

","name":"delay"}],"name":"setTimeout","longname":"Meteor.setTimeout","kind":"function","scope":"static","options":[],"locus":"Anywhere"},"setInterval":{"memberof":"Meteor","summary":"Call a function repeatedly, with a time delay between calls.","params":[{"type":{"names":["function"]},"description":"

The function to run

","name":"func"},{"type":{"names":["Number"]},"description":"

Number of milliseconds to wait between each function call.

","name":"delay"}],"name":"setInterval","longname":"Meteor.setInterval","kind":"function","scope":"static","options":[],"locus":"Anywhere"},"clearInterval":{"memberof":"Meteor","summary":"Cancel a repeating function call scheduled by `Meteor.setInterval`.","params":[{"type":{"names":["Number"]},"description":"

The handle returned by Meteor.setInterval

","name":"id"}],"name":"clearInterval","longname":"Meteor.clearInterval","kind":"function","scope":"static","options":[],"locus":"Anywhere"},"clearTimeout":{"memberof":"Meteor","summary":"Cancel a function call scheduled by `Meteor.setTimeout`.","params":[{"type":{"names":["Number"]},"description":"

The handle returned by Meteor.setTimeout

","name":"id"}],"name":"clearTimeout","longname":"Meteor.clearTimeout","kind":"function","scope":"static","options":[],"locus":"Anywhere"},"absoluteUrl":{"summary":"Generate an absolute URL pointing to the application. The server reads from the `ROOT_URL` environment variable to determine where it is running. This is taken care of automatically for apps deployed with `meteor deploy`, but must be provided when using `meteor bundle`.","params":[{"type":{"names":["String"]},"optional":true,"description":"

A path to append to the root URL. Do not include a leading "/".

","name":"path"},{"type":{"names":["Object"]},"optional":true,"name":"options"}],"name":"absoluteUrl","longname":"Meteor.absoluteUrl","kind":"function","memberof":"Meteor","scope":"static","options":[{"type":{"names":["Boolean"]},"description":"

Create an HTTPS URL.

","name":"secure"},{"type":{"names":["Boolean"]},"description":"

Replace localhost with 127.0.0.1. Useful for services that don't recognize localhost as a domain name.

","name":"replaceLocalhost"},{"type":{"names":["String"]},"description":"

Override the default ROOT_URL from the server environment. For example: "http://foo.example.com"

","name":"rootUrl"}],"locus":"Anywhere"},"Error":{"summary":"This class represents a symbolic error thrown by a method.","kind":"class","params":[{"type":{"names":["Number"]},"description":"

A numeric error code, likely similar to an HTTP code (eg, 404, 500).

","name":"error"},{"type":{"names":["String"]},"optional":true,"description":"

Optional. A short human-readable summary of the error, like 'Not Found'.

","name":"reason"},{"type":{"names":["String"]},"optional":true,"description":"

Optional. Additional information about the error, like a textual stack trace.

","name":"details"}],"name":"Error","longname":"Meteor.Error","memberof":"Meteor","scope":"static","options":[],"locus":"Anywhere"}},"Mongo":{"summary":"Namespace for MongoDB-related items","kind":"namespace","name":"Mongo","longname":"Mongo","scope":"global","Cursor#forEach":{"summary":"Call `callback` once for each matching document, sequentially and synchronously.","kind":"function","name":"forEach","scope":"instance","memberof":"Mongo.Cursor","params":[{"type":{"names":["function"]},"description":"

Function to call. It will be called with three arguments: the document, a 0-based index, and cursor itself.

","name":"callback"},{"type":{"names":["Any"]},"optional":true,"description":"

An object which will be the value of this inside callback.

","name":"thisArg"}],"longname":"Mongo.Cursor#forEach","options":[],"locus":"Anywhere"},"Cursor#map":{"summary":"Map callback over all matching documents. Returns an Array.","kind":"function","name":"map","scope":"instance","memberof":"Mongo.Cursor","params":[{"type":{"names":["function"]},"description":"

Function to call. It will be called with three arguments: the document, a 0-based index, and cursor itself.

","name":"callback"},{"type":{"names":["Any"]},"optional":true,"description":"

An object which will be the value of this inside callback.

","name":"thisArg"}],"longname":"Mongo.Cursor#map","options":[],"locus":"Anywhere"},"Cursor#fetch":{"summary":"Return all matching documents as an Array.","memberof":"Mongo.Cursor","kind":"function","name":"fetch","scope":"instance","longname":"Mongo.Cursor#fetch","options":[],"params":[],"locus":"Anywhere"},"Cursor#count":{"summary":"Returns the number of documents that match a query.","memberof":"Mongo.Cursor","kind":"function","name":"count","scope":"instance","longname":"Mongo.Cursor#count","options":[],"params":[],"locus":"Anywhere"},"Cursor#observe":{"summary":"Watch a query. Receive callbacks as the result set changes.","memberof":"Mongo.Cursor","scope":"instance","params":[{"type":{"names":["Object"]},"description":"

Functions to call to deliver the result set as it changes

","name":"callbacks"}],"name":"observe","longname":"Mongo.Cursor#observe","kind":"function","options":[],"locus":"Anywhere"},"Cursor#observeChanges":{"summary":"Watch a query. Receive callbacks as the result set changes. Only the differences between the old and new documents are passed to the callbacks.","memberof":"Mongo.Cursor","scope":"instance","params":[{"type":{"names":["Object"]},"description":"

Functions to call to deliver the result set as it changes

","name":"callbacks"}],"name":"observeChanges","longname":"Mongo.Cursor#observeChanges","kind":"function","options":[],"locus":"Anywhere"},"Collection#insert":{"summary":"Insert a document in the collection. Returns its unique _id.","kind":"function","name":"insert","memberof":"Mongo.Collection","scope":"instance","params":[{"type":{"names":["Object"]},"description":"

The document to insert. May not yet have an _id attribute, in which case Meteor will generate one for you.

","name":"doc"},{"type":{"names":["function"]},"optional":true,"description":"

Optional. If present, called with an error object as the first argument and, if no error, the _id as the second.

","name":"callback"}],"longname":"Mongo.Collection#insert","options":[],"locus":"Anywhere"},"Collection#update":{"summary":"Modify one or more documents in the collection. Returns the number of affected documents.","kind":"function","name":"update","memberof":"Mongo.Collection","scope":"instance","params":[{"type":{"names":["MongoSelector"]},"description":"

Specifies which documents to modify

","name":"selector"},{"type":{"names":["MongoModifier"]},"description":"

Specifies how to modify the documents

","name":"modifier"},{"type":{"names":["Object"]},"optional":true,"name":"options"},{"type":{"names":["function"]},"optional":true,"description":"

Optional. If present, called with an error object as the first argument and, if no error, the number of affected documents as the second.

","name":"callback"}],"longname":"Mongo.Collection#update","options":[{"type":{"names":["Boolean"]},"description":"

True to modify all matching documents; false to only modify one of the matching documents (the default).

","name":"multi"},{"type":{"names":["Boolean"]},"description":"

True to insert a document if no matching documents are found.

","name":"upsert"}],"locus":"Anywhere"},"Collection#find":{"summary":"Find the documents in a collection that match the selector.","kind":"function","name":"find","memberof":"Mongo.Collection","scope":"instance","params":[{"type":{"names":["MongoSelector"]},"optional":true,"description":"

A query describing the documents to find

","name":"selector"},{"type":{"names":["Object"]},"optional":true,"name":"options"}],"longname":"Mongo.Collection#find","options":[{"type":{"names":["MongoSortSpecifier"]},"description":"

Sort order (default: natural order)

","name":"sort"},{"type":{"names":["Number"]},"description":"

Number of results to skip at the beginning

","name":"skip"},{"type":{"names":["Number"]},"description":"

Maximum number of results to return

","name":"limit"},{"type":{"names":["MongoFieldSpecifier"]},"description":"

Dictionary of fields to return or exclude.

","name":"fields"},{"type":{"names":["Boolean"]},"description":"

(Client only) Default true; pass false to disable reactivity

","name":"reactive"},{"type":{"names":["function"]},"description":"

Overrides transform on the Collection for this cursor. Pass null to disable transformation.

","name":"transform"}],"locus":"Anywhere"},"Collection#findOne":{"summary":"Finds the first document that matches the selector, as ordered by sort and skip options.","kind":"function","name":"findOne","memberof":"Mongo.Collection","scope":"instance","params":[{"type":{"names":["MongoSelector"]},"optional":true,"description":"

A query describing the documents to find

","name":"selector"},{"type":{"names":["Object"]},"optional":true,"name":"options"}],"longname":"Mongo.Collection#findOne","options":[{"type":{"names":["MongoSortSpecifier"]},"description":"

Sort order (default: natural order)

","name":"sort"},{"type":{"names":["Number"]},"description":"

Number of results to skip at the beginning

","name":"skip"},{"type":{"names":["MongoFieldSpecifier"]},"description":"

Dictionary of fields to return or exclude.

","name":"fields"},{"type":{"names":["Boolean"]},"description":"

(Client only) Default true; pass false to disable reactivity

","name":"reactive"},{"type":{"names":["function"]},"description":"

Overrides transform on the Collection for this cursor. Pass null to disable transformation.

","name":"transform"}],"locus":"Anywhere"},"Collection#remove":{"summary":"Remove documents from the collection","kind":"function","name":"remove","memberof":"Mongo.Collection","scope":"instance","params":[{"type":{"names":["MongoSelector"]},"description":"

Specifies which documents to remove

","name":"selector"},{"type":{"names":["function"]},"optional":true,"description":"

Optional. If present, called with an error object as its argument.

","name":"callback"}],"longname":"Mongo.Collection#remove","options":[],"locus":"Anywhere"},"Collection#upsert":{"summary":"Modify one or more documents in the collection, or insert one if no matching documents were found. Returns an object with keys `numberAffected` (the number of documents modified) and `insertedId` (the unique _id of the document that was inserted, if any).","params":[{"type":{"names":["MongoSelector"]},"description":"

Specifies which documents to modify

","name":"selector"},{"type":{"names":["MongoModifier"]},"description":"

Specifies how to modify the documents

","name":"modifier"},{"type":{"names":["Object"]},"optional":true,"name":"options"},{"type":{"names":["function"]},"optional":true,"description":"

Optional. If present, called with an error object as the first argument and, if no error, the number of affected documents as the second.

","name":"callback"}],"name":"upsert","longname":"Mongo.Collection#upsert","kind":"function","memberof":"Mongo.Collection","scope":"instance","options":[{"type":{"names":["Boolean"]},"description":"

True to modify all matching documents; false to only modify one of the matching documents (the default).

","name":"multi"}],"locus":"Anywhere"},"Collection#allow":{"summary":"Allow users to write directly to this collection from client code, subject to limitations you define.","params":[{"type":{"names":["Object"]},"name":"options"}],"name":"allow","longname":"Mongo.Collection#allow","kind":"function","memberof":"Mongo.Collection","scope":"instance","options":[{"type":{"names":["function"]},"description":"

Functions that look at a proposed modification to the database and return true if it should be allowed.

","name":"insert, update, remove"},{"type":{"names":["Array."]},"description":"

Optional performance enhancement. Limits the fields that will be fetched from the database for inspection by your update and remove functions.

","name":"fetch"},{"type":{"names":["function"]},"description":"

Overrides transform on the Collection. Pass null to disable transformation.

","name":"transform"}],"locus":"Server"},"Collection#deny":{"summary":"Override `allow` rules.","params":[{"type":{"names":["Object"]},"name":"options"}],"name":"deny","longname":"Mongo.Collection#deny","kind":"function","memberof":"Mongo.Collection","scope":"instance","options":[{"type":{"names":["function"]},"description":"

Functions that look at a proposed modification to the database and return true if it should be denied, even if an allow rule says otherwise.

","name":"insert, update, remove"},{"type":{"names":["Array."]},"description":"

Optional performance enhancement. Limits the fields that will be fetched from the database for inspection by your update and remove functions.

","name":"fetch"},{"type":{"names":["function"]},"description":"

Overrides transform on the Collection. Pass null to disable transformation.

","name":"transform"}],"locus":"Server"},"Collection":{"summary":"Constructor for a Collection","kind":"class","params":[{"type":{"names":["String"]},"description":"

The name of the collection. If null, creates an unmanaged (unsynchronized) local collection.

","name":"name"},{"type":{"names":["Object"]},"optional":true,"name":"options"}],"name":"Collection","longname":"Mongo.Collection","memberof":"Mongo","scope":"static","options":[{"type":{"names":["Object"]},"description":"

The server connection that will manage this collection. Uses the default connection if not specified. Pass the return value of calling DDP.connect to specify a different server. Pass null to specify no connection. Unmanaged (name is null) collections cannot specify a connection.

","name":"connection"},{"type":{"names":["String"]},"description":"

The method of generating the _id fields of new documents in this collection. Possible values:

\n\n

The default id generation technique is 'STRING'.

","name":"idGeneration"},{"type":{"names":["function"]},"description":"

An optional transformation function. Documents will be passed through this function before being returned from fetch or findOne, and before being passed to callbacks of observe, map, forEach, allow, and deny. Transforms are not applied for the callbacks of observeChanges or to cursors returned from publish functions.

","name":"transform"}],"locus":"Anywhere","instancename":"collection"},"ObjectID":{"summary":"Create a Mongo-style `ObjectID`. If you don't specify a `hexString`, the `ObjectID` will generated randomly (not using MongoDB's ID construction rules).","kind":"class","params":[{"type":{"names":["String"]},"description":"

Optional. The 24-character hexadecimal contents of the ObjectID to create

","name":"hexString"}],"name":"ObjectID","longname":"Mongo.ObjectID","memberof":"Mongo","scope":"static","options":[],"locus":"Anywhere"},"Cursor":{"summary":"To create a cursor, use find. To access the documents in a cursor, use forEach, map, or fetch.","kind":"class","name":"Cursor","longname":"Mongo.Cursor","memberof":"Mongo","scope":"static","options":[],"params":[],"instancename":"cursor"}},"Assets":{"summary":"The namespace for Assets functions, lives in the bundler.","kind":"namespace","name":"Assets","longname":"Assets","getText":{"summary":"Retrieve the contents of the static server asset as a UTF8-encoded string.","memberof":"Assets","params":[{"type":{"names":["String"]},"description":"

The path of the asset, relative to the application's private subdirectory.

","name":"assetPath"},{"type":{"names":["function"]},"optional":true,"description":"

Optional callback, which is called asynchronously with the error or result after the function is complete. If not provided, the function runs synchronously.

","name":"asyncCallback"}],"name":"getText","longname":"Assets.getText","kind":"function","scope":"static","options":[],"locus":"Server"},"getBinary":{"summary":"Retrieve the contents of the static server asset as an [EJSON Binary](#ejson_new_binary).","memberof":"Assets","params":[{"type":{"names":["String"]},"description":"

The path of the asset, relative to the application's private subdirectory.

","name":"assetPath"},{"type":{"names":["function"]},"optional":true,"description":"

Optional callback, which is called asynchronously with the error or result after the function is complete. If not provided, the function runs synchronously.

","name":"asyncCallback"}],"name":"getBinary","longname":"Assets.getBinary","kind":"function","scope":"static","options":[],"locus":"Server"}},"App":{"kind":"namespace","name":"App","scope":"global","summary":"The App configuration object in mobile-config.js","longname":"App","info":{"summary":"Set your mobile app's core configuration information.","params":[{"type":{"names":["Object"]},"name":"options"}],"memberof":"App","name":"info","longname":"App.info","kind":"function","scope":"static","options":[{"type":{"names":["String"]},"optional":true,"description":"

Each of the options correspond to a key in the app's core configuration\nas described in the PhoneGap documentation.

","name":"id, version, name, description, author, email, website"}]},"setPreference":{"summary":"Add a preference for your build as described in the\n[PhoneGap documentation](http://docs.phonegap.com/en/3.5.0/config_ref_index.md.html#The%20config.xml%20File_global_preferences).","params":[{"type":{"names":["String"]},"description":"

A preference name supported by Phonegap's\nconfig.xml.

","name":"name"},{"type":{"names":["String"]},"description":"

The value for that preference.

","name":"value"}],"memberof":"App","name":"setPreference","longname":"App.setPreference","kind":"function","scope":"static","options":[]},"configurePlugin":{"summary":"Set the build-time configuration for a Phonegap plugin.","params":[{"type":{"names":["String"]},"description":"

The identifier of the plugin you want to\nconfigure.

","name":"pluginName"},{"type":{"names":["Object"]},"description":"

A set of key-value pairs which will be passed\nat build-time to configure the specified plugin.

","name":"config"}],"memberof":"App","name":"configurePlugin","longname":"App.configurePlugin","kind":"function","scope":"static","options":[]},"icons":{"summary":"Set the icons for your mobile app.","params":[{"type":{"names":["Object"]},"description":"

An Object where the keys are different\ndevices and screen sizes, and values are image paths\nrelative to the project root directory.

\n

Valid key values:

\n
    \n
  • iphone
  • \n
  • iphone-2x
  • \n
  • iphone-3x
  • \n
  • ipad
  • \n
  • ipad-2x
  • \n
  • android_ldpi
  • \n
  • android_mdpi
  • \n
  • android_hdpi
  • \n
  • android_xhdpi
  • \n
","name":"icons"}],"memberof":"App","name":"icons","longname":"App.icons","kind":"function","scope":"static","options":[]},"launchScreens":{"summary":"Set the launch screen images for your mobile app.","params":[{"type":{"names":["Object"]},"description":"

A dictionary where keys are different\ndevices, screen sizes, and orientations, and the values are image paths\nrelative to the project root directory.

\n

For Android, launch screen images should\nbe special "Nine-patch" image files that specify how they should be\nstretched. See the Android docs.

\n

Valid key values:

\n
    \n
  • iphone
  • \n
  • iphone_2x
  • \n
  • iphone5
  • \n
  • iphone6
  • \n
  • iphone6p_portrait
  • \n
  • iphone6p_landscape
  • \n
  • ipad_portrait
  • \n
  • ipad_portrait_2x
  • \n
  • ipad_landscape
  • \n
  • ipad_landscape_2x
  • \n
  • android_ldpi_portrait
  • \n
  • android_ldpi_landscape
  • \n
  • android_mdpi_portrait
  • \n
  • android_mdpi_landscape
  • \n
  • android_hdpi_portrait
  • \n
  • android_hdpi_landscape
  • \n
  • android_xhdpi_portrait
  • \n
  • android_xhdpi_landscape
  • \n
","name":"launchScreens"}],"memberof":"App","name":"launchScreens","longname":"App.launchScreens","kind":"function","scope":"static","options":[]}},"Plugin":{"scope":"global","kind":"namespace","name":"Plugin","summary":"The namespace that is exposed inside build plugin files.","longname":"Plugin","registerSourceHandler":{"summary":"Inside a build plugin source file specified in\n[Package.registerBuildPlugin](#Package-registerBuildPlugin),\nadd a handler to compile files with a certain file extension.","params":[{"type":{"names":["String"]},"description":"

The file extension that this plugin\nshould handle, without the first dot.\nExamples: "coffee", "coffee.md".

","name":"fileExtension"},{"type":{"names":["function"]},"description":"

A function that takes one argument,\na CompileStep object.

\n

Documentation for CompileStep is available on the GitHub Wiki.

","name":"handler"}],"memberof":"Plugin","name":"registerSourceHandler","longname":"Plugin.registerSourceHandler","kind":"function","scope":"static","options":[],"locus":"Build Plugin"}},"Package":{"scope":"global","name":"Package","summary":"The Package object in package.js","kind":"namespace","longname":"Package","locus":"package.js","describe":{"summary":"Provide basic package information.","memberof":"Package","params":[{"type":{"names":["Object"]},"name":"options"}],"name":"describe","longname":"Package.describe","kind":"function","scope":"static","options":[{"type":{"names":["String"]},"description":"

A concise 1-2 sentence description of\nthe package, required for publication.

","name":"summary"},{"type":{"names":["String"]},"description":"

The (extended)\nsemver version for your package. Additionally,\nMeteor allows a wrap number, to follow the version number. If you are\nporting another package that uses semver versioning, you may want to\nuse the original version, postfixed with the _. For example,\n'1.2.3_1', '2.4.5-rc1_4'. Wrap numbers sort after the original numbers:\n'1.2.3' < '1.2.3_1' < '1.2.3_2' < '1.2.4-rc.0'. By default, wrap\nnumbers don't affect compatibility, so 1.2.3_1 is compatible with\n1.2.3, 1.2.3_3, etc. If no version is specified, this field defaults to\n0.0.0. You need to specify a version to publish to the package\nserver.

","name":"version"},{"type":{"names":["String"]},"description":"

Optional name override. By default, the\npackage name comes from the name of its directory.

","name":"name"},{"type":{"names":["String"]},"description":"

Optional Git URL to the source repository.

","name":"git"}],"locus":"package.js"},"onUse":{"summary":"Define package dependencies and expose package methods.","memberof":"Package","params":[{"type":{"names":["function"]},"description":"

A function that takes in the package control 'api' object, which keeps track of dependencies and exports.

","name":"func"}],"name":"onUse","longname":"Package.onUse","kind":"function","scope":"static","options":[],"locus":"package.js"},"onTest":{"summary":"Define dependencies and expose package methods for unit tests.","memberof":"Package","params":[{"type":{"names":["function"]},"description":"

A function that takes in the package control 'api' object, which keeps track of dependencies and exports.

","name":"func"}],"name":"onTest","longname":"Package.onTest","kind":"function","scope":"static","options":[],"locus":"package.js"},"registerBuildPlugin":{"summary":"Define a build plugin. A build plugin extends the build\nprocess for apps and packages that use this package. For example,\nthe `coffeescript` package uses a build plugin to compile CoffeeScript\nsource files into JavaScript.","params":[{"type":{"names":["Object"]},"optional":true,"name":"options"}],"memberof":"Package","name":"registerBuildPlugin","longname":"Package.registerBuildPlugin","kind":"function","scope":"static","options":[{"type":{"names":["String"]},"description":"

A cosmetic name, must be unique in the\npackage.

","name":"name"},{"type":{"names":["String","Array."]},"description":"

Meteor packages that this\nplugin uses, independent of the packages specified in\napi.onUse.

","name":"use"},{"type":{"names":["Array."]},"description":"

The source files that make up the\nbuild plugin, independent from api.addFiles.

","name":"sources"},{"type":{"names":["Object"]},"description":"

An object where the keys\nare NPM package names, and the keys are the version numbers of\nrequired NPM packages, just like in Npm.depends.

","name":"npmDependencies"}],"locus":"package.js"}},"Npm":{"kind":"namespace","name":"Npm","scope":"global","summary":"The Npm object in package.js and package source files.","longname":"Npm","depends":{"summary":"Specify which [NPM](https://www.npmjs.org/) packages\nyour Meteor package depends on.","params":[{"type":{"names":["Object"]},"description":"

An object where the keys are package\nnames and the values are version numbers in string form.\nYou can only depend on exact versions of NPM packages. Example:

\n
Npm.depends({moment: "2.8.3"});
","name":"dependencies"}],"memberof":"Npm","name":"depends","longname":"Npm.depends","kind":"function","scope":"static","options":[],"locus":"package.js"},"require":{"summary":"Require a package that was specified using\n`Npm.depends()`.","params":[{"type":{"names":["String"]},"description":"

The name of the package to require.

","name":"name"}],"memberof":"Npm","name":"require","longname":"Npm.require","kind":"function","scope":"static","options":[],"locus":"Server"}},"Cordova":{"kind":"namespace","name":"Cordova","scope":"global","summary":"The Cordova object in package.js.","longname":"Cordova","depends":{"summary":"Specify which [Cordova / PhoneGap](http://cordova.apache.org/)\nplugins your Meteor package depends on.\n\nPlugins are installed from\n[plugins.cordova.io](http://plugins.cordova.io/), so the plugins and\nversions specified must exist there. Alternatively, the version\ncan be replaced with a GitHub tarball URL as described in the\n[Cordova / PhoneGap](https://github.com/meteor/meteor/wiki/Meteor-Cordova-Phonegap-integration#meteor-packages-with-cordovaphonegap-dependencies)\npage of the Meteor wiki on GitHub.","params":[{"type":{"names":["Object"]},"description":"

An object where the keys are plugin\nnames and the values are version numbers or GitHub tarball URLs\nin string form.\nExample:

\n
Cordova.depends({\n  "org.apache.cordova.camera": "0.3.0"\n});

Alternatively, with a GitHub URL:

\n
Cordova.depends({\n  "org.apache.cordova.camera":\n    "https://github.com/apache/cordova-plugin-camera/tarball/d84b875c"\n});
","name":"dependencies"}],"memberof":"Cordova","name":"depends","longname":"Cordova.depends","kind":"function","scope":"static","options":[],"locus":"package.js"}},"currentUser":{"scope":"global","name":"currentUser","summary":"Calls [Meteor.user()](#meteor_user). Use `{{#if currentUser}}` to check whether the user is logged in.","longname":"currentUser","kind":"member","ishelper":"true"},"loggingIn":{"scope":"global","name":"loggingIn","summary":"Calls [Meteor.loggingIn()](#meteor_loggingin).","longname":"loggingIn","kind":"member","ishelper":"true"},"Template#created":{"name":"created","scope":"instance","memberof":"Template","summary":"Provide a callback when an instance of a template is created.","longname":"Template#created","kind":"member","locus":"Client"},"Template#rendered":{"name":"rendered","scope":"instance","memberof":"Template","summary":"Provide a callback when an instance of a template is rendered.","longname":"Template#rendered","kind":"member","locus":"Client"},"Template#destroyed":{"name":"destroyed","scope":"instance","memberof":"Template","summary":"Provide a callback when an instance of a template is destroyed.","longname":"Template#destroyed","kind":"member","locus":"Client"},"Blaze":{"TemplateInstance#data":{"scope":"instance","memberof":"Blaze.TemplateInstance","name":"data","summary":"The data context of this instance's latest invocation.","longname":"Blaze.TemplateInstance#data","kind":"member","locus":"Client"},"TemplateInstance#view":{"name":"view","memberof":"Blaze.TemplateInstance","scope":"instance","summary":"The [View](#blaze_view) object for this invocation of the template.","longname":"Blaze.TemplateInstance#view","kind":"member","locus":"Client"},"TemplateInstance#firstNode":{"name":"firstNode","memberof":"Blaze.TemplateInstance","scope":"instance","summary":"The first top-level DOM node in this template instance.","longname":"Blaze.TemplateInstance#firstNode","kind":"member","locus":"Client"},"TemplateInstance#lastNode":{"name":"lastNode","memberof":"Blaze.TemplateInstance","scope":"instance","summary":"The last top-level DOM node in this template instance.","longname":"Blaze.TemplateInstance#lastNode","kind":"member","locus":"Client"},"currentView":{"summary":"The View corresponding to the current template helper, event handler, callback, or autorun. If there isn't one, `null`.","name":"currentView","longname":"Blaze.currentView","kind":"member","memberof":"Blaze","scope":"static","locus":"Client"},"With":{"summary":"Constructs a View that renders content with a data context.","params":[{"type":{"names":["Object","function"]},"description":"

An object to use as the data context, or a function returning such an object. If a function is provided, it will be reactively re-run.

","name":"data"},{"type":{"names":["function"]},"description":"

A Function that returns renderable content.

","name":"contentFunc"}],"name":"With","longname":"Blaze.With","kind":"function","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"If":{"summary":"Constructs a View that renders content conditionally.","params":[{"type":{"names":["function"]},"description":"

A function to reactively re-run. Whether the result is truthy or falsy determines whether contentFunc or elseFunc is shown. An empty array is considered falsy.

","name":"conditionFunc"},{"type":{"names":["function"]},"description":"

A Function that returns renderable content.

","name":"contentFunc"},{"type":{"names":["function"]},"optional":true,"description":"

Optional. A Function that returns renderable content. If no elseFunc is supplied, no content is shown in the "else" case.

","name":"elseFunc"}],"name":"If","longname":"Blaze.If","kind":"function","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"Unless":{"summary":"An inverted [`Blaze.If`](#blaze_if).","params":[{"type":{"names":["function"]},"description":"

A function to reactively re-run. If the result is falsy, contentFunc is shown, otherwise elseFunc is shown. An empty array is considered falsy.

","name":"conditionFunc"},{"type":{"names":["function"]},"description":"

A Function that returns renderable content.

","name":"contentFunc"},{"type":{"names":["function"]},"optional":true,"description":"

Optional. A Function that returns renderable content. If no elseFunc is supplied, no content is shown in the "else" case.

","name":"elseFunc"}],"name":"Unless","longname":"Blaze.Unless","kind":"function","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"Each":{"summary":"Constructs a View that renders `contentFunc` for each item in a sequence.","params":[{"type":{"names":["function"]},"description":"

A function to reactively re-run. The function may return a Cursor, an array, null, or undefined.

","name":"argFunc"},{"type":{"names":["function"]},"description":"

A Function that returns renderable content.

","name":"contentFunc"},{"type":{"names":["function"]},"optional":true,"description":"

Optional. A Function that returns renderable content to display in the case when there are no items to display.

","name":"elseFunc"}],"name":"Each","longname":"Blaze.Each","kind":"function","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"isTemplate":{"summary":"Returns true if `value` is a template object like `Template.myTemplate`.","params":[{"type":{"names":["Any"]},"description":"

The value to test.

","name":"value"}],"name":"isTemplate","longname":"Blaze.isTemplate","kind":"function","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"TemplateInstance#$":{"summary":"Find all elements matching `selector` in this template instance, and return them as a JQuery object.","params":[{"type":{"names":["String"]},"description":"

The CSS selector to match, scoped to the template contents.

","name":"selector"}],"name":"$","longname":"Blaze.TemplateInstance#$","kind":"function","memberof":"Blaze.TemplateInstance","scope":"instance","options":[],"locus":"Client"},"TemplateInstance#findAll":{"summary":"Find all elements matching `selector` in this template instance.","params":[{"type":{"names":["String"]},"description":"

The CSS selector to match, scoped to the template contents.

","name":"selector"}],"name":"findAll","longname":"Blaze.TemplateInstance#findAll","kind":"function","memberof":"Blaze.TemplateInstance","scope":"instance","options":[],"locus":"Client"},"TemplateInstance#find":{"summary":"Find one element matching `selector` in this template instance.","params":[{"type":{"names":["String"]},"description":"

The CSS selector to match, scoped to the template contents.

","name":"selector"}],"name":"find","longname":"Blaze.TemplateInstance#find","kind":"function","memberof":"Blaze.TemplateInstance","scope":"instance","options":[],"locus":"Client"},"TemplateInstance#autorun":{"summary":"A version of [Tracker.autorun](#tracker_autorun) that is stopped when the template is destroyed.","params":[{"type":{"names":["function"]},"description":"

The function to run. It receives one argument: a Tracker.Computation object.

","name":"runFunc"}],"name":"autorun","longname":"Blaze.TemplateInstance#autorun","kind":"function","memberof":"Blaze.TemplateInstance","scope":"instance","options":[],"locus":"Client"},"render":{"summary":"Renders a template or View to DOM nodes and inserts it into the DOM, returning a rendered [View](#blaze_view) which can be passed to [`Blaze.remove`](#blaze_remove).","params":[{"type":{"names":["Template","Blaze.View"]},"description":"

The template (e.g. Template.myTemplate) or View object to render. If a template, a View object is constructed. If a View, it must be an unrendered View, which becomes a rendered View and is returned.

","name":"templateOrView"},{"type":{"names":["DOMNode"]},"description":"

The node that will be the parent of the rendered template. It must be an Element node.

","name":"parentNode"},{"type":{"names":["DOMNode"]},"optional":true,"description":"

Optional. If provided, must be a child of parentNode; the template will be inserted before this node. If not provided, the template will be inserted as the last child of parentNode.

","name":"nextNode"},{"type":{"names":["Blaze.View"]},"optional":true,"description":"

Optional. If provided, it will be set as the rendered View's parentView.

","name":"parentView"}],"name":"render","longname":"Blaze.render","kind":"function","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"renderWithData":{"summary":"Renders a template or View to DOM nodes with a data context. Otherwise identical to `Blaze.render`.","params":[{"type":{"names":["Template","Blaze.View"]},"description":"

The template (e.g. Template.myTemplate) or View object to render.

","name":"templateOrView"},{"type":{"names":["Object","function"]},"description":"

The data context to use, or a function returning a data context. If a function is provided, it will be reactively re-run.

","name":"data"},{"type":{"names":["DOMNode"]},"description":"

The node that will be the parent of the rendered template. It must be an Element node.

","name":"parentNode"},{"type":{"names":["DOMNode"]},"optional":true,"description":"

Optional. If provided, must be a child of parentNode; the template will be inserted before this node. If not provided, the template will be inserted as the last child of parentNode.

","name":"nextNode"},{"type":{"names":["Blaze.View"]},"optional":true,"description":"

Optional. If provided, it will be set as the rendered View's parentView.

","name":"parentView"}],"name":"renderWithData","longname":"Blaze.renderWithData","kind":"function","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"remove":{"summary":"Removes a rendered View from the DOM, stopping all reactive updates and event listeners on it.","params":[{"type":{"names":["Blaze.View"]},"description":"

The return value from Blaze.render or Blaze.renderWithData.

","name":"renderedView"}],"name":"remove","longname":"Blaze.remove","kind":"function","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"toHTML":{"summary":"Renders a template or View to a string of HTML.","params":[{"type":{"names":["Template","Blaze.View"]},"description":"

The template (e.g. Template.myTemplate) or View object from which to generate HTML.

","name":"templateOrView"}],"name":"toHTML","longname":"Blaze.toHTML","kind":"function","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"toHTMLWithData":{"summary":"Renders a template or View to HTML with a data context. Otherwise identical to `Blaze.toHTML`.","params":[{"type":{"names":["Template","Blaze.View"]},"description":"

The template (e.g. Template.myTemplate) or View object from which to generate HTML.

","name":"templateOrView"},{"type":{"names":["Object","function"]},"description":"

The data context to use, or a function returning a data context.

","name":"data"}],"name":"toHTMLWithData","longname":"Blaze.toHTMLWithData","kind":"function","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"getData":{"summary":"Returns the current data context, or the data context that was used when rendering a particular DOM element or View from a Meteor template.","params":[{"type":{"names":["DOMElement","Blaze.View"]},"optional":true,"description":"

Optional. An element that was rendered by a Meteor, or a View.

","name":"elementOrView"}],"name":"getData","longname":"Blaze.getData","kind":"function","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"getView":{"summary":"Gets either the current View, or the View enclosing the given DOM element.","params":[{"type":{"names":["DOMElement"]},"optional":true,"description":"

Optional. If specified, the View enclosing element is returned.

","name":"element"}],"name":"getView","longname":"Blaze.getView","kind":"function","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"Template":{"kind":"class","summary":"Constructor for a Template, which is used to construct Views with particular name and content.","params":[{"type":{"names":["String"]},"optional":true,"description":"

Optional. A name for Views constructed by this Template. See view.name.

","name":"viewName"},{"type":{"names":["function"]},"description":"

A function that returns renderable content. This function is used as the renderFunction for Views constructed by this Template.

","name":"renderFunction"}],"name":"Template","longname":"Blaze.Template","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"TemplateInstance":{"kind":"class","summary":"The class for template instances","params":[{"type":{"names":["Blaze.View"]},"name":"view"}],"name":"TemplateInstance","longname":"Blaze.TemplateInstance","memberof":"Blaze","scope":"static","options":[],"instancename":"template"},"View":{"kind":"class","summary":"Constructor for a View, which represents a reactive region of DOM.","params":[{"type":{"names":["String"]},"optional":true,"description":"

Optional. A name for this type of View. See view.name.

","name":"name"},{"type":{"names":["function"]},"description":"

A function that returns renderable content. In this function, this is bound to the View.

","name":"renderFunction"}],"name":"View","longname":"Blaze.View","memberof":"Blaze","scope":"static","options":[],"locus":"Client"}},"MethodInvocation#isSimulation":{"summary":"Access inside a method invocation. Boolean value, true if this invocation is a stub.","name":"isSimulation","memberof":"MethodInvocation","scope":"instance","longname":"MethodInvocation#isSimulation","kind":"member","locus":"Anywhere"},"MethodInvocation#userId":{"summary":"The id of the user that made this method call, or `null` if no user was logged in.","name":"userId","memberof":"MethodInvocation","scope":"instance","longname":"MethodInvocation#userId","kind":"member","locus":"Anywhere"},"MethodInvocation#connection":{"summary":"Access inside a method invocation. The [connection](#meteor_onconnection) that this method was received on. `null` if the method is not associated with a connection, eg. a server initiated method call.","name":"connection","memberof":"MethodInvocation","scope":"instance","longname":"MethodInvocation#connection","kind":"member","locus":"Server"},"Subscription#connection":{"summary":"Access inside the publish function. The incoming [connection](#meteor_onconnection) for this subscription.","name":"connection","memberof":"Subscription","scope":"instance","longname":"Subscription#connection","kind":"member","locus":"Server"},"Subscription#userId":{"summary":"Access inside the publish function. The id of the logged-in user, or `null` if no user is logged in.","memberof":"Subscription","name":"userId","scope":"instance","longname":"Subscription#userId","kind":"member","locus":"Server"},"Template":{"body":{"summary":"The [template object](#templates_api) representing your `` tag.","name":"body","longname":"Template.body","kind":"member","memberof":"Template","scope":"static","locus":"Client"},"instance":{"kind":"function","name":"instance","memberof":"Template","summary":"The [template instance](#template_inst) corresponding to the current template helper, event handler, callback, or autorun. If there isn't one, `null`.","scope":"static","longname":"Template.instance","options":[],"params":[],"locus":"Client"},"currentData":{"summary":"Returns the data context of the current helper, or the data context of the template that declares the current event handler or callback. Establishes a reactive dependency on the result.","kind":"function","name":"currentData","longname":"Template.currentData","memberof":"Template","scope":"static","options":[],"params":[],"locus":"Client"},"parentData":{"summary":"Accesses other data contexts that enclose the current data context.","kind":"function","params":[{"type":{"names":["Integer"]},"description":"

The number of levels beyond the current data context to look.

","name":"numLevels"}],"name":"parentData","longname":"Template.parentData","memberof":"Template","scope":"static","options":[],"locus":"Client"},"registerHelper":{"summary":"Defines a [helper function](#template_helpers) which can be used from all templates.","kind":"function","params":[{"type":{"names":["String"]},"description":"

The name of the helper function you are defining.

","name":"name"},{"type":{"names":["function"]},"description":"

The helper function itself.

","name":"function"}],"name":"registerHelper","longname":"Template.registerHelper","memberof":"Template","scope":"static","options":[],"locus":"Client"},"dynamic":{"memberof":"Template","kind":"function","name":"dynamic","summary":"Choose a template to include dynamically, by name.","params":[{"type":{"names":["String"]},"description":"

The name of the template to include.

","name":"template"},{"type":{"names":["Object"]},"optional":true,"description":"

Optional. The data context in which to include the template.

","name":"data"}],"scope":"static","longname":"Template.dynamic","options":[],"istemplate":"true","locus":"Templates"},"summary":"The class for defining templates","kind":"class","name":"Template","longname":"Template","scope":"global","options":[],"params":[],"instancename":"Template.myTemplate"},"Tracker":{"active":{"summary":"True if there is a current computation, meaning that dependencies on reactive data sources will be tracked and potentially cause the current computation to be rerun.","name":"active","longname":"Tracker.active","kind":"member","memberof":"Tracker","scope":"static","locus":"Client"},"currentComputation":{"summary":"The current computation, or `null` if there isn't one. The current computation is the [`Tracker.Computation`](#tracker_computation) object created by the innermost active call to `Tracker.autorun`, and it's the computation that gains dependencies when reactive data sources are accessed.","name":"currentComputation","longname":"Tracker.currentComputation","kind":"member","memberof":"Tracker","scope":"static","locus":"Client"},"Computation#stopped":{"summary":"True if this computation has been stopped.","memberof":"Tracker.Computation","scope":"instance","name":"stopped","longname":"Tracker.Computation#stopped","kind":"member","locus":"Client"},"Computation#invalidated":{"summary":"True if this computation has been invalidated (and not yet rerun), or if it has been stopped.","memberof":"Tracker.Computation","scope":"instance","name":"invalidated","longname":"Tracker.Computation#invalidated","kind":"member","locus":"Client"},"Computation#firstRun":{"summary":"True during the initial run of the computation at the time `Tracker.autorun` is called, and false on subsequent reruns and at other times.","memberof":"Tracker.Computation","scope":"instance","name":"firstRun","longname":"Tracker.Computation#firstRun","kind":"member","locus":"Client"},"Computation":{"summary":"A Computation object represents code that is repeatedly rerun\nin response to\nreactive data changes. Computations don't have return values; they just\nperform actions, such as rerendering a template on the screen. Computations\nare created using Tracker.autorun. Use stop to prevent further rerunning of a\ncomputation.","name":"Computation","longname":"Tracker.Computation","kind":"function","memberof":"Tracker","scope":"static","options":[],"params":[],"instancename":"computation"},"Computation#onInvalidate":{"summary":"Registers `callback` to run when this computation is next invalidated, or runs it immediately if the computation is already invalidated. The callback is run exactly once and not upon future invalidations unless `onInvalidate` is called again after the computation becomes valid again.","params":[{"type":{"names":["function"]},"description":"

Function to be called on invalidation. Receives one argument, the computation that was invalidated.

","name":"callback"}],"name":"onInvalidate","longname":"Tracker.Computation#onInvalidate","kind":"function","memberof":"Tracker.Computation","scope":"instance","options":[],"locus":"Client"},"Computation#invalidate":{"summary":"Invalidates this computation so that it will be rerun.","name":"invalidate","longname":"Tracker.Computation#invalidate","kind":"function","memberof":"Tracker.Computation","scope":"instance","options":[],"params":[],"locus":"Client"},"Computation#stop":{"summary":"Prevents this computation from rerunning.","name":"stop","longname":"Tracker.Computation#stop","kind":"function","memberof":"Tracker.Computation","scope":"instance","options":[],"params":[],"locus":"Client"},"Dependency#depend":{"summary":"Declares that the current computation (or `fromComputation` if given) depends on `dependency`. The computation will be invalidated the next time `dependency` changes.\n\nIf there is no current computation and `depend()` is called with no arguments, it does nothing and returns false.\n\nReturns true if the computation is a new dependent of `dependency` rather than an existing one.","params":[{"type":{"names":["Tracker.Computation"]},"optional":true,"description":"

An optional computation declared to depend on dependency instead of the current computation.

","name":"fromComputation"}],"name":"depend","longname":"Tracker.Dependency#depend","kind":"function","memberof":"Tracker.Dependency","scope":"instance","options":[],"locus":"Client"},"Dependency#changed":{"summary":"Invalidate all dependent computations immediately and remove them as dependents.","name":"changed","longname":"Tracker.Dependency#changed","kind":"function","memberof":"Tracker.Dependency","scope":"instance","options":[],"params":[],"locus":"Client"},"Dependency#hasDependents":{"summary":"True if this Dependency has one or more dependent Computations, which would be invalidated if this Dependency were to change.","name":"hasDependents","longname":"Tracker.Dependency#hasDependents","kind":"function","memberof":"Tracker.Dependency","scope":"instance","options":[],"params":[],"locus":"Client"},"flush":{"summary":"Process all reactive updates immediately and ensure that all invalidated computations are rerun.","name":"flush","longname":"Tracker.flush","kind":"function","memberof":"Tracker","scope":"static","options":[],"params":[],"locus":"Client"},"autorun":{"summary":"Run a function now and rerun it later whenever its dependencies change. Returns a Computation object that can be used to stop or observe the rerunning.","params":[{"type":{"names":["function"]},"description":"

The function to run. It receives one argument: the Computation object that will be returned.

","name":"runFunc"}],"name":"autorun","longname":"Tracker.autorun","kind":"function","memberof":"Tracker","scope":"static","options":[],"locus":"Client"},"nonreactive":{"summary":"Run a function without tracking dependencies.","params":[{"type":{"names":["function"]},"description":"

A function to call immediately.

","name":"func"}],"name":"nonreactive","longname":"Tracker.nonreactive","kind":"function","memberof":"Tracker","scope":"static","options":[],"locus":"Client"},"onInvalidate":{"summary":"Registers a new [`onInvalidate`](#computation_oninvalidate) callback on the current computation (which must exist), to be called immediately when the current computation is invalidated or stopped.","params":[{"type":{"names":["function"]},"description":"

A callback function that will be invoked as func(c), where c is the computation on which the callback is registered.

","name":"callback"}],"name":"onInvalidate","longname":"Tracker.onInvalidate","kind":"function","memberof":"Tracker","scope":"static","options":[],"locus":"Client"},"afterFlush":{"summary":"Schedules a function to be called during the next flush, or later in the current flush if one is in progress, after all invalidated computations have been rerun. The function will be run once and not on subsequent flushes unless `afterFlush` is called again.","params":[{"type":{"names":["function"]},"description":"

A function to call at flush time.

","name":"callback"}],"name":"afterFlush","longname":"Tracker.afterFlush","kind":"function","memberof":"Tracker","scope":"static","options":[],"locus":"Client"},"Dependency":{"summary":"A Dependency represents an atomic unit of reactive data that a\ncomputation might depend on. Reactive data sources such as Session or\nMinimongo internally create different Dependency objects for different\npieces of data, each of which may be depended on by multiple computations.\nWhen the data changes, the computations are invalidated.","kind":"class","name":"Dependency","longname":"Tracker.Dependency","memberof":"Tracker","scope":"static","options":[],"params":[],"instancename":"dependency"}},"CompileStep#inputSize":{"summary":"The total number of bytes in the input file.","memberof":"CompileStep","scope":"instance","type":{"names":["Integer"]},"name":"inputSize","longname":"CompileStep#inputSize","kind":"member"},"CompileStep#inputPath":{"summary":"The filename and relative path of the input file.\nPlease don't use this filename to read the file from disk, instead\nuse [compileStep.read](CompileStep-read).","type":{"names":["String"]},"scope":"instance","memberof":"CompileStep","name":"inputPath","longname":"CompileStep#inputPath","kind":"member"},"CompileStep#fullInputPath":{"summary":"The filename and absolute path of the input file.\nPlease don't use this filename to read the file from disk, instead\nuse [compileStep.read](CompileStep-read).","type":{"names":["String"]},"scope":"instance","memberof":"CompileStep","name":"fullInputPath","longname":"CompileStep#fullInputPath","kind":"member"},"CompileStep#pathForSourceMap":{"summary":"If you are generating a sourcemap for the compiled file, use\nthis path for the original file in the sourcemap.","type":{"names":["String"]},"memberof":"CompileStep","scope":"instance","name":"pathForSourceMap","longname":"CompileStep#pathForSourceMap","kind":"member"},"CompileStep#packageName":{"summary":"The name of the package in which the file being built exists.","type":{"names":["String"]},"memberof":"CompileStep","scope":"instance","name":"packageName","longname":"CompileStep#packageName","kind":"member"},"CompileStep#rootOutputPath":{"summary":"On web targets, this will be the root URL prepended\nto the paths you pick for your output files. For example,\nit could be \"/packages/my-package\".","type":{"names":["String"]},"memberof":"CompileStep","scope":"instance","name":"rootOutputPath","longname":"CompileStep#rootOutputPath","kind":"member"},"CompileStep#arch":{"summary":"The architecture for which we are building. Can be \"os\",\n\"web.browser\", or \"web.cordova\".","type":{"names":["String"]},"memberof":"CompileStep","scope":"instance","name":"arch","longname":"CompileStep#arch","kind":"member"},"CompileStep#fileOptions":{"summary":"Any options passed to \"api.addFiles\".","type":{"names":["Object"]},"memberof":"CompileStep","scope":"instance","name":"fileOptions","longname":"CompileStep#fileOptions","kind":"member"},"CompileStep#declaredExports":{"summary":"The list of exports that the current package has defined.\nCan be used to treat those symbols differently during compilation.","type":{"names":["Object"]},"memberof":"CompileStep","scope":"instance","name":"declaredExports","longname":"CompileStep#declaredExports","kind":"member"},"Template#helpers":{"summary":"Specify template helpers available to this template.","params":[{"type":{"names":["Object"]},"description":"

Dictionary of helper functions by name.

","name":"helpers"}],"name":"helpers","longname":"Template#helpers","kind":"function","memberof":"Template","scope":"instance","options":[],"locus":"Client"},"Template#events":{"summary":"Specify event handlers for this template.","params":[{"type":{"names":["EventMap"]},"description":"

Event handlers to associate with this template.

","name":"eventMap"}],"name":"events","longname":"Template#events","kind":"function","memberof":"Template","scope":"instance","options":[],"locus":"Client"},"check":{"summary":"Check that a value matches a [pattern](#matchpatterns).\nIf the value does not match the pattern, throw a `Match.Error`.\n\nParticularly useful to assert that arguments to a function have the right\ntypes and structure.","params":[{"type":{"names":["Any"]},"description":"

The value to check

","name":"value"},{"type":{"names":["MatchPattern"]},"description":"

The pattern to match\nvalue against

","name":"pattern"}],"name":"check","longname":"check","kind":"function","scope":"global","options":[],"locus":"Anywhere"},"Match":{"test":{"summary":"Returns true if the value matches the pattern.","params":[{"type":{"names":["Any"]},"description":"

The value to check

","name":"value"},{"type":{"names":["MatchPattern"]},"description":"

The pattern to match value against

","name":"pattern"}],"name":"test","longname":"Match.test","kind":"function","memberof":"Match","scope":"static","options":[],"locus":"Anywhere"}},"MethodInvocation":{"summary":"The state for a single invocation of a method, referenced by this\ninside a method definition.","params":[{"type":{"names":["Object"]},"name":"options"}],"name":"MethodInvocation","longname":"MethodInvocation","kind":"function","scope":"global","options":[],"instancename":"this"},"MethodInvocation#unblock":{"summary":"Call inside a method invocation. Allow subsequent method from this client to begin running in a new fiber.","memberof":"MethodInvocation","scope":"instance","name":"unblock","longname":"MethodInvocation#unblock","kind":"function","options":[],"params":[],"locus":"Server"},"MethodInvocation#setUserId":{"summary":"Set the logged in user.","memberof":"MethodInvocation","scope":"instance","params":[{"type":{"names":["String","null"]},"description":"

The value that should be returned by userId on this connection.

","name":"userId"}],"name":"setUserId","longname":"MethodInvocation#setUserId","kind":"function","options":[],"locus":"Server"},"DDP":{"connect":{"summary":"Connect to the server of a different Meteor application to subscribe to its document sets and invoke its remote methods.","params":[{"type":{"names":["String"]},"description":"

The URL of another Meteor application.

","name":"url"}],"name":"connect","longname":"DDP.connect","kind":"function","memberof":"DDP","scope":"static","options":[],"locus":"Anywhere"}},"Subscription#error":{"summary":"Call inside the publish function. Stops this client's subscription, triggering a call on the client to the `onError` callback passed to [`Meteor.subscribe`](#meteor_subscribe), if any. If `error` is not a [`Meteor.Error`](#meteor_error), it will be [sanitized](#meteor_error).","params":[{"type":{"names":["Error"]},"description":"

The error to pass to the client.

","name":"error"}],"scope":"instance","memberof":"Subscription","name":"error","longname":"Subscription#error","kind":"function","options":[],"locus":"Server"},"Subscription#stop":{"summary":"Call inside the publish function. Stops this client's subscription; the `onError` callback is *not* invoked on the client.","scope":"instance","memberof":"Subscription","name":"stop","longname":"Subscription#stop","kind":"function","options":[],"params":[],"locus":"Server"},"Subscription#onStop":{"summary":"Call inside the publish function. Registers a callback function to run when the subscription is stopped.","memberof":"Subscription","scope":"instance","params":[{"type":{"names":["function"]},"description":"

The callback function

","name":"func"}],"name":"onStop","longname":"Subscription#onStop","kind":"function","options":[],"locus":"Server"},"Subscription#added":{"summary":"Call inside the publish function. Informs the subscriber that a document has been added to the record set.","memberof":"Subscription","scope":"instance","params":[{"type":{"names":["String"]},"description":"

The name of the collection that contains the new document.

","name":"collection"},{"type":{"names":["String"]},"description":"

The new document's ID.

","name":"id"},{"type":{"names":["Object"]},"description":"

The fields in the new document. If _id is present it is ignored.

","name":"fields"}],"name":"added","longname":"Subscription#added","kind":"function","options":[],"locus":"Server"},"Subscription#changed":{"summary":"Call inside the publish function. Informs the subscriber that a document in the record set has been modified.","memberof":"Subscription","scope":"instance","params":[{"type":{"names":["String"]},"description":"

The name of the collection that contains the changed document.

","name":"collection"},{"type":{"names":["String"]},"description":"

The changed document's ID.

","name":"id"},{"type":{"names":["Object"]},"description":"

The fields in the document that have changed, together with their new values. If a field is not present in fields it was left unchanged; if it is present in fields and has a value of undefined it was removed from the document. If _id is present it is ignored.

","name":"fields"}],"name":"changed","longname":"Subscription#changed","kind":"function","options":[],"locus":"Server"},"Subscription#removed":{"summary":"Call inside the publish function. Informs the subscriber that a document has been removed from the record set.","memberof":"Subscription","scope":"instance","params":[{"type":{"names":["String"]},"description":"

The name of the collection that the document has been removed from.

","name":"collection"},{"type":{"names":["String"]},"description":"

The ID of the document that has been removed.

","name":"id"}],"name":"removed","longname":"Subscription#removed","kind":"function","options":[],"locus":"Server"},"Subscription#ready":{"summary":"Call inside the publish function. Informs the subscriber that an initial, complete snapshot of the record set has been sent. This will trigger a call on the client to the `onReady` callback passed to [`Meteor.subscribe`](#meteor_subscribe), if any.","memberof":"Subscription","scope":"instance","name":"ready","longname":"Subscription#ready","kind":"function","options":[],"params":[],"locus":"Server"},"Email":{"send":{"summary":"Send an email. Throws an `Error` on failure to contact mail server\nor if mail server returns an error. All fields should match\n[RFC5322](http://tools.ietf.org/html/rfc5322) specification.","params":[{"type":{"names":["Object"]},"name":"options"}],"name":"send","longname":"Email.send","kind":"function","memberof":"Email","scope":"static","options":[{"type":{"names":["String"]},"description":"

"From:" address (required)

","name":"from"},{"type":{"names":["String","Array."]},"description":"

"To:", "Cc:", "Bcc:", and "Reply-To:" addresses

","name":"to, cc, bcc, replyTo"},{"type":{"names":["String"]},"optional":true,"description":"

"Subject:" line

","name":"subject"},{"type":{"names":["String"]},"optional":true,"description":"

Mail body (in plain text or HTML)

","name":"text, html"},{"type":{"names":["Object"]},"optional":true,"description":"

Dictionary of custom headers

","name":"headers"}],"locus":"Server"}},"HTTP":{"call":{"summary":"Perform an outbound HTTP request.","params":[{"type":{"names":["String"]},"description":"

The HTTP method to use, such as "GET", "POST", or "HEAD".

","name":"method"},{"type":{"names":["String"]},"description":"

The URL to retrieve.

","name":"url"},{"type":{"names":["Object"]},"optional":true,"name":"options"},{"type":{"names":["function"]},"optional":true,"description":"

Optional callback. If passed, the method runs asynchronously, instead of synchronously, and calls asyncCallback. On the client, this callback is required.

","name":"asyncCallback"}],"name":"call","longname":"HTTP.call","kind":"function","memberof":"HTTP","scope":"static","options":[{"type":{"names":["String"]},"description":"

String to use as the HTTP request body.

","name":"content"},{"type":{"names":["Object"]},"description":"

JSON-able object to stringify and use as the HTTP request body. Overwrites content.

","name":"data"},{"type":{"names":["String"]},"description":"

Query string to go in the URL. Overwrites any query string in url.

","name":"query"},{"type":{"names":["Object"]},"description":"

Dictionary of request parameters to be encoded and placed in the URL (for GETs) or request body (for POSTs). If content or data is specified, params will always be placed in the URL.

","name":"params"},{"type":{"names":["String"]},"description":"

HTTP basic authentication string of the form "username:password"

","name":"auth"},{"type":{"names":["Object"]},"description":"

Dictionary of strings, headers to add to the HTTP request.

","name":"headers"},{"type":{"names":["Number"]},"description":"

Maximum time in milliseconds to wait for the request before failing. There is no timeout by default.

","name":"timeout"},{"type":{"names":["Boolean"]},"description":"

If true, transparently follow HTTP redirects. Cannot be set to false on the client. Default true.

","name":"followRedirects"}],"locus":"Anywhere"},"get":{"summary":"Send an HTTP `GET` request. Equivalent to calling [`HTTP.call`](#http_call) with \"GET\" as the first argument.","params":[{"type":{"names":["String"]},"description":"

The URL to which the request should be sent.

","name":"url"},{"type":{"names":["Object"]},"optional":true,"description":"

Options passed on to HTTP.call.

","name":"callOptions"},{"type":{"names":["function"]},"optional":true,"description":"

Callback that is called when the request is completed. Required on the client.

","name":"asyncCallback"}],"name":"get","longname":"HTTP.get","kind":"function","memberof":"HTTP","scope":"static","options":[],"locus":"Anywhere"},"post":{"summary":"Send an HTTP `POST` request. Equivalent to calling [`HTTP.call`](#http_call) with \"POST\" as the first argument.","params":[{"type":{"names":["String"]},"description":"

The URL to which the request should be sent.

","name":"url"},{"type":{"names":["Object"]},"optional":true,"description":"

Options passed on to HTTP.call.

","name":"callOptions"},{"type":{"names":["function"]},"optional":true,"description":"

Callback that is called when the request is completed. Required on the client.

","name":"asyncCallback"}],"name":"post","longname":"HTTP.post","kind":"function","memberof":"HTTP","scope":"static","options":[],"locus":"Anywhere"},"put":{"summary":"Send an HTTP `PUT` request. Equivalent to calling [`HTTP.call`](#http_call) with \"PUT\" as the first argument.","params":[{"type":{"names":["String"]},"description":"

The URL to which the request should be sent.

","name":"url"},{"type":{"names":["Object"]},"optional":true,"description":"

Options passed on to HTTP.call.

","name":"callOptions"},{"type":{"names":["function"]},"optional":true,"description":"

Callback that is called when the request is completed. Required on the client.

","name":"asyncCallback"}],"name":"put","longname":"HTTP.put","kind":"function","memberof":"HTTP","scope":"static","options":[],"locus":"Anywhere"},"del":{"summary":"Send an HTTP `DELETE` request. Equivalent to calling [`HTTP.call`](#http_call) with \"DELETE\" as the first argument. (Named `del` to avoid conflic with the Javascript keyword `delete`)","params":[{"type":{"names":["String"]},"description":"

The URL to which the request should be sent.

","name":"url"},{"type":{"names":["Object"]},"optional":true,"description":"

Options passed on to HTTP.call.

","name":"callOptions"},{"type":{"names":["function"]},"optional":true,"description":"

Callback that is called when the request is completed. Required on the client.

","name":"asyncCallback"}],"name":"del","longname":"HTTP.del","kind":"function","memberof":"HTTP","scope":"static","options":[],"locus":"Anywhere"}},"ReactiveVar#get":{"summary":"Returns the current value of the ReactiveVar, establishing a reactive dependency.","name":"get","longname":"ReactiveVar#get","kind":"function","memberof":"ReactiveVar","scope":"instance","options":[],"params":[],"locus":"Client"},"ReactiveVar#set":{"summary":"Sets the current value of the ReactiveVar, invalidating the Computations that called `get` if `newValue` is different from the old value.","params":[{"type":{"names":["Any"]},"name":"newValue"}],"name":"set","longname":"ReactiveVar#set","kind":"function","memberof":"ReactiveVar","scope":"instance","options":[],"locus":"Client"},"Session":{"set":{"memberof":"Session","kind":"function","name":"set","summary":"Set a variable in the session. Notify any listeners that the value has changed (eg: redraw templates, and rerun any [`Tracker.autorun`](#tracker_autorun) computations, that called [`Session.get`](#session_get) on this `key`.)","params":[{"type":{"names":["String"]},"description":"

The key to set, eg, selectedItem

","name":"key"},{"type":{"names":["EJSONable","undefined"]},"description":"

The new value for key

","name":"value"}],"scope":"static","longname":"Session.set","options":[],"locus":"Client"},"setDefault":{"memberof":"Session","kind":"function","name":"setDefault","summary":"Set a variable in the session if it is undefined. Otherwise works exactly the same as [`Session.set`](#session_set).","params":[{"type":{"names":["String"]},"description":"

The key to set, eg, selectedItem

","name":"key"},{"type":{"names":["EJSONable","undefined"]},"description":"

The new value for key

","name":"value"}],"scope":"static","longname":"Session.setDefault","options":[],"locus":"Client"},"get":{"memberof":"Session","kind":"function","name":"get","summary":"Get the value of a session variable. If inside a [reactive computation](#reactivity), invalidate the computation the next time the value of the variable is changed by [`Session.set`](#session_set). This returns a clone of the session value, so if it's an object or an array, mutating the returned value has no effect on the value stored in the session.","params":[{"type":{"names":["String"]},"description":"

The name of the session variable to return

","name":"key"}],"scope":"static","longname":"Session.get","options":[],"locus":"Client"},"equals":{"memberof":"Session","kind":"function","name":"equals","summary":"Test if a session variable is equal to a value. If inside a [reactive computation](#reactivity), invalidate the computation the next time the variable changes to or from the value.","params":[{"type":{"names":["String"]},"description":"

The name of the session variable to test

","name":"key"},{"type":{"names":["String","Number","Boolean","null","undefined"]},"description":"

The value to test against

","name":"value"}],"scope":"static","longname":"Session.equals","options":[],"locus":"Client"}},"CompileStep#read":{"summary":"Read from the input file. If `n` is specified, returns the\nnext `n` bytes of the file as a Buffer. XXX not sure if this actually\nreturns a String sometimes...","params":[{"type":{"names":["Integer"]},"optional":true,"description":"

The number of bytes to return.

","name":"n"}],"scope":"instance","memberof":"CompileStep","name":"read","longname":"CompileStep#read","kind":"function","options":[]},"CompileStep#addHtml":{"summary":"Works in web targets only. Add markup to the `head` or `body`\nsection of the document.","params":[{"type":{"names":["Object"]},"name":"options"}],"memberof":"CompileStep","scope":"instance","name":"addHtml","longname":"CompileStep#addHtml","kind":"function","options":[{"type":{"names":["String"]},"description":"

Which section of the document should\nbe appended to. Can only be "head" or "body".

","name":"section"},{"type":{"names":["String"]},"description":"

The content to append.

","name":"data"}]},"CompileStep#addStylesheet":{"summary":"Web targets only. Add a stylesheet to the document.","params":[{"type":{"names":["Object"]},"name":"options"},{"type":{"names":["String"]},"description":"

The requested path for the added CSS, may not be\nsatisfied if there are path conflicts.

","name":"path"},{"type":{"names":["String"]},"description":"

The content of the stylesheet that should be\nadded.

","name":"data"},{"type":{"names":["String"]},"description":"

A stringified JSON sourcemap, in case the\nstylesheet was generated from a different file.

","name":"sourceMap"}],"memberof":"CompileStep","scope":"instance","name":"addStylesheet","longname":"CompileStep#addStylesheet","kind":"function","options":[]},"CompileStep#addJavaScript":{"summary":"Add JavaScript code. The code added will only see the\nnamespaces imported by this package as runtime dependencies using\n['api.use'](#PackageAPI-use). If the file being compiled was added\nwith the bare flag, the resulting JavaScript won't be wrapped in a\nclosure.","params":[{"type":{"names":["Object"]},"name":"options"}],"memberof":"CompileStep","scope":"instance","name":"addJavaScript","longname":"CompileStep#addJavaScript","kind":"function","options":[{"type":{"names":["String"]},"description":"

The path at which the JavaScript file\nshould be inserted, may not be honored in case of path conflicts.

","name":"path"},{"type":{"names":["String"]},"description":"

The code to be added.

","name":"data"},{"type":{"names":["String"]},"description":"

The path that will be used in\nany error messages generated by this file, e.g. foo.js:4:1: error.

","name":"sourcePath"}]},"CompileStep#addAsset":{"summary":"Add a file to serve as-is to the browser or to include on\nthe browser, depending on the target. On the web, it will be served\nat the exact path requested. For server targets, it can be retrieved\nusing `Assets.getText` or `Assets.getBinary`.","params":[{"type":{"names":["Object"]},"name":"options"},{"type":{"names":["String"]},"description":"

The path at which to serve the asset.

","name":"path"},{"type":{"names":["Buffer","String"]},"description":"

The data that should be placed in\nthe file.

","name":"data"}],"memberof":"CompileStep","scope":"instance","name":"addAsset","longname":"CompileStep#addAsset","kind":"function","options":[]},"CompileStep#error":{"summary":"Display a build error.","params":[{"type":{"names":["Object"]},"name":"options"},{"type":{"names":["String"]},"description":"

The error message to display.

","name":"message"},{"type":{"names":["String"]},"optional":true,"description":"

The path to display in the error message.

","name":"sourcePath"},{"type":{"names":["Integer"]},"description":"

The line number to display in the error message.

","name":"line"},{"type":{"names":["String"]},"description":"

The function name to display in the error message.

","name":"func"}],"memberof":"CompileStep","scope":"instance","name":"error","longname":"CompileStep#error","kind":"function","options":[]},"PackageAPI#use":{"memberof":"PackageAPI","scope":"instance","summary":"Depend on package `packagename`.","params":[{"type":{"names":["String","Array."]},"description":"

Packages being depended on.\nPackage names may be suffixed with an @version tag.

\n

In general, you must specify a package's version (e.g.,\n'accounts@1.0.0' to use version 1.0.0 or a higher\ncompatible version (ex: 1.0.1, 1.5.0, etc.) of the\naccounts package). If you are sourcing core\npackages from a Meteor release with versionsFrom, you may leave\noff version names for core packages. You may also specify constraints,\nsuch as 'my:forms@=1.0.0 (this package demands my:forms at 1.0.0 exactly),\nor 'my:forms@1.0.0 || =2.0.1' (my:forms at 1.x.y, or exactly 2.0.1).

","name":"packageNames"},{"type":{"names":["String"]},"optional":true,"description":"

If you only use the package on the\nserver (or the client), you can pass in the second argument (e.g.,\n'server' or 'client') to specify what architecture the package is\nused with.

","name":"architecture"},{"type":{"names":["Object"]},"optional":true,"name":"options"}],"name":"use","longname":"PackageAPI#use","kind":"function","options":[{"type":{"names":["Boolean"]},"description":"

Establish a weak dependency on a\npackage. If package A has a weak dependency on package B, it means\nthat including A in an app does not force B to be included too — but,\nif B is included or by another package, then B will load before A.\nYou can use this to make packages that optionally integrate with or\nenhance other packages if those packages are present.\nWhen you weakly depend on a package you don't see its exports.\nYou can detect if the possibly-present weakly-depended-on package\nis there by seeing if Package.foo exists, and get its exports\nfrom the same place.

","name":"weak"},{"type":{"names":["Boolean"]},"description":"

It's okay to load this dependency\nafter your package. (In general, dependencies specified by api.use\nare loaded before your package.) You can use this option to break\ncircular dependencies.

","name":"unordered"}],"locus":"package.js"},"PackageAPI#imply":{"memberof":"PackageAPI","summary":"Give users of this package access to another package (by passing in the string `packagename`) or a collection of packages (by passing in an array of strings [`packagename1`, `packagename2`]","scope":"instance","params":[{"type":{"names":["String","Array."]},"description":"

Name of a package, or array of package names, with an optional @version component for each.

","name":"packageSpecs"}],"name":"imply","longname":"PackageAPI#imply","kind":"function","options":[],"locus":"package.js"},"PackageAPI#addFiles":{"memberof":"PackageAPI","scope":"instance","summary":"Specify the source code for your package.","params":[{"type":{"names":["String","Array."]},"description":"

Name of the source file, or array of strings of source file names.

","name":"filename"},{"type":{"names":["String"]},"optional":true,"description":"

If you only want to export the file on the server (or the client), you can pass in the second argument (e.g., 'server' or 'client') to specify what architecture the file is used with.

","name":"architecture"}],"name":"addFiles","longname":"PackageAPI#addFiles","kind":"function","options":[],"locus":"package.js"},"PackageAPI#versionsFrom":{"memberof":"PackageAPI","scope":"instance","summary":"Use versions of core packages from a release. Unless provided, all packages will default to the versions released along with `meteorversion`. This will save you from having to figure out the exact versions of the core packages you want to use. For example, if the newest release of meteor is METEOR@0.9.0 and it uses jquery@1.0.0, you can use `api.versionsFrom('METEOR@0.9.0')`. If your package uses jQuery, it will automatically depend on jQuery 1.0.0 when it is published. You may specify more than one release, in which case the constraints will be parsed with an or: 'jquery@1.0.0 || 2.0.0'.","params":[{"type":{"names":["String"]},"description":"

Specification of a release: track@version. Just 'version' (ex: "0.9.0") is sufficient if using the default release track

","name":"meteorRelease"}],"name":"versionsFrom","longname":"PackageAPI#versionsFrom","kind":"function","options":[],"locus":"package.js"},"PackageAPI#export":{"memberof":"PackageAPI","scope":"instance","summary":"Export package-level variables in your package. The specified variables (declared without `var` in the source code) will be available to packages that use this package.","params":[{"type":{"names":["String"]},"description":"

Name of the object.

","name":"exportedObject"},{"type":{"names":["String"]},"optional":true,"description":"

If you only want to export the object on the server (or the client), you can pass in the second argument (e.g., 'server' or 'client') to specify what architecture the export is used with.

","name":"architecture"}],"name":"export","longname":"PackageAPI#export","kind":"function","options":[],"locus":"package.js"},"Subscription":{"summary":"The server's side of a subscription","kind":"class","name":"Subscription","longname":"Subscription","options":[],"params":[],"instancename":"this"},"ReactiveVar":{"kind":"class","summary":"Constructor for a ReactiveVar, which represents a single reactive variable.","params":[{"type":{"names":["Any"]},"description":"

The initial value to set. equalsFunc is ignored when setting the initial value.

","name":"initialValue"},{"type":{"names":["function"]},"optional":true,"description":"

Optional. A function of two arguments, called on the old value and the new value whenever the ReactiveVar is set. If it returns true, no set is performed. If omitted, the default equalsFunc returns true if its arguments are === and are of type number, boolean, string, undefined, or null.

","name":"equalsFunc"}],"name":"ReactiveVar","longname":"ReactiveVar","scope":"global","options":[],"instancename":"reactiveVar","locus":"Client"},"CompileStep":{"description":"

The comments for this class aren't used to generate docs right now.\nThe docs live in the GitHub Wiki at: https://github.com/meteor/meteor/wiki/CompileStep-API-for-Build-Plugin-Source-Handlers

","kind":"class","name":"CompileStep","summary":"The object passed into Plugin.registerSourceHandler","scope":"global","longname":"CompileStep","options":[],"params":[]},"PackageAPI":{"kind":"class","name":"PackageAPI","scope":"global","summary":"The API object passed into the Packages.onUse function.","longname":"PackageAPI","options":[],"params":[],"instancename":"api"}}; \ No newline at end of file +// This file is automatically generated by JSDoc; regenerate it with scripts/admin/jsdoc/jsdoc.sh +DocsData = {"Accounts":{"kind":"namespace","name":"Accounts","summary":"The namespace for all accounts-related methods.","longname":"Accounts","ui":{"summary":"Accounts UI","kind":"namespace","memberof":"Accounts","name":"ui","longname":"Accounts.ui","scope":"static","config":{"summary":"Configure the behavior of [`{{> loginButtons}}`](#accountsui).","params":[{"type":{"names":["Object"]},"name":"options"}],"name":"config","longname":"Accounts.ui.config","kind":"function","memberof":"Accounts.ui","scope":"static","options":[{"type":{"names":["Object"]},"description":"

Which permissions to request from the user for each external service.

","name":"requestPermissions"},{"type":{"names":["Object"]},"description":"

To ask the user for permission to act on their behalf when offline, map the relevant external service to true. Currently only supported with Google. See Meteor.loginWithExternalService for more details.

","name":"requestOfflineToken"},{"type":{"names":["Object"]},"description":"

If true, forces the user to approve the app's permissions, even if previously approved. Currently only supported with Google.

","name":"forceApprovalPrompt"},{"type":{"names":["String"]},"description":"

Which fields to display in the user creation form. One of 'USERNAME_AND_EMAIL', 'USERNAME_AND_OPTIONAL_EMAIL', 'USERNAME_ONLY', or 'EMAIL_ONLY' (default).

","name":"passwordSignupFields"}],"locus":"Client"}},"emailTemplates":{"summary":"Options to customize emails sent from the Accounts system.","name":"emailTemplates","longname":"Accounts.emailTemplates","kind":"member","memberof":"Accounts","scope":"static","locus":"Anywhere"},"config":{"summary":"Set global accounts options.","params":[{"type":{"names":["Object"]},"name":"options"}],"name":"config","longname":"Accounts.config","kind":"function","memberof":"Accounts","scope":"static","options":[{"type":{"names":["Boolean"]},"description":"

New users with an email address will receive an address verification email.

","name":"sendVerificationEmail"},{"type":{"names":["Boolean"]},"description":"

Calls to createUser from the client will be rejected. In addition, if you are using accounts-ui, the "Create account" link will not be available.

","name":"forbidClientAccountCreation"},{"type":{"names":["String","function"]},"description":"

If set to a string, only allows new users if the domain part of their email address matches the string. If set to a function, only allows new users if the function returns true. The function is passed the full email address of the proposed new user. Works with password-based sign-in and external services that expose email addresses (Google, Facebook, GitHub). All existing users still can log in after enabling this option. Example: Accounts.config({ restrictCreationByEmailDomain: 'school.edu' }).

","name":"restrictCreationByEmailDomain"},{"type":{"names":["Number"]},"description":"

The number of days from when a user logs in until their token expires and they are logged out. Defaults to 90. Set to null to disable login expiration.

","name":"loginExpirationInDays"},{"type":{"names":["String"]},"description":"

When using the oauth-encryption package, the 16 byte key using to encrypt sensitive account credentials in the database, encoded in base64. This option may only be specifed on the server. See packages/oauth-encryption/README.md for details.

","name":"oauthSecretKey"}],"locus":"Anywhere"},"validateLoginAttempt":{"summary":"Validate login attempts.","params":[{"type":{"names":["function"]},"description":"

Called whenever a login is attempted (either successful or unsuccessful). A login can be aborted by returning a falsy value or throwing an exception.

","name":"func"}],"name":"validateLoginAttempt","longname":"Accounts.validateLoginAttempt","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Server"},"onLogin":{"summary":"Register a callback to be called after a login attempt succeeds.","params":[{"type":{"names":["function"]},"description":"

The callback to be called when login is successful.

","name":"func"}],"name":"onLogin","longname":"Accounts.onLogin","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Server"},"onLoginFailure":{"summary":"Register a callback to be called after a login attempt fails.","params":[{"type":{"names":["function"]},"description":"

The callback to be called after the login has failed.

","name":"func"}],"name":"onLoginFailure","longname":"Accounts.onLoginFailure","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Server"},"onCreateUser":{"summary":"Customize new user creation.","params":[{"type":{"names":["function"]},"description":"

Called whenever a new user is created. Return the new user object, or throw an Error to abort the creation.

","name":"func"}],"name":"onCreateUser","longname":"Accounts.onCreateUser","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Server"},"validateNewUser":{"summary":"Set restrictions on new user creation.","params":[{"type":{"names":["function"]},"description":"

Called whenever a new user is created. Takes the new user object, and returns true to allow the creation or false to abort.

","name":"func"}],"name":"validateNewUser","longname":"Accounts.validateNewUser","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Server"},"onResetPasswordLink":{"summary":"Register a function to call when a reset password link is clicked\nin an email sent by\n[`Accounts.sendResetPasswordEmail`](#accounts_sendresetpasswordemail).\nThis function should be called in top-level code, not inside\n`Meteor.startup()`.","params":[{"type":{"names":["function"]},"description":"

The function to call. It is given two arguments:

\n
    \n
  1. token: A password reset token that can be passed to\nAccounts.resetPassword.
  2. \n
  3. done: A function to call when the password reset UI flow is complete. The normal\nlogin process is suspended until this function is called, so that the\npassword for user A can be reset even if user B was logged in.
  4. \n
","name":"callback"}],"name":"onResetPasswordLink","longname":"Accounts.onResetPasswordLink","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Client"},"onEmailVerificationLink":{"summary":"Register a function to call when an email verification link is\nclicked in an email sent by\n[`Accounts.sendVerificationEmail`](#accounts_sendverificationemail).\nThis function should be called in top-level code, not inside\n`Meteor.startup()`.","params":[{"type":{"names":["function"]},"description":"

The function to call. It is given two arguments:

\n
    \n
  1. token: An email verification token that can be passed to\nAccounts.verifyEmail.
  2. \n
  3. done: A function to call when the email verification UI flow is complete.\nThe normal login process is suspended until this function is called, so\nthat the user can be notified that they are verifying their email before\nbeing logged in.
  4. \n
","name":"callback"}],"name":"onEmailVerificationLink","longname":"Accounts.onEmailVerificationLink","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Client"},"onEnrollmentLink":{"summary":"Register a function to call when an account enrollment link is\nclicked in an email sent by\n[`Accounts.sendEnrollmentEmail`](#accounts_sendenrollmentemail).\nThis function should be called in top-level code, not inside\n`Meteor.startup()`.","params":[{"type":{"names":["function"]},"description":"

The function to call. It is given two arguments:

\n
    \n
  1. token: A password reset token that can be passed to\nAccounts.resetPassword to give the newly\nenrolled account a password.
  2. \n
  3. done: A function to call when the enrollment UI flow is complete.\nThe normal login process is suspended until this function is called, so that\nuser A can be enrolled even if user B was logged in.
  4. \n
","name":"callback"}],"name":"onEnrollmentLink","longname":"Accounts.onEnrollmentLink","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Client"},"createUser":{"summary":"Create a new user.","params":[{"type":{"names":["Object"]},"name":"options"},{"type":{"names":["function"]},"optional":true,"description":"

Client only, optional callback. Called with no arguments on success, or with a single Error argument on failure.

","name":"callback"}],"name":"createUser","longname":"Accounts.createUser","kind":"function","memberof":"Accounts","scope":"static","options":[{"type":{"names":["String"]},"description":"

A unique name for this user.

","name":"username"},{"type":{"names":["String"]},"description":"

The user's email address.

","name":"email"},{"type":{"names":["String"]},"description":"

The user's password. This is not sent in plain text over the wire.

","name":"password"},{"type":{"names":["Object"]},"description":"

The user's profile, typically including the name field.

","name":"profile"}],"locus":"Anywhere"},"changePassword":{"summary":"Change the current user's password. Must be logged in.","params":[{"type":{"names":["String"]},"description":"

The user's current password. This is not sent in plain text over the wire.

","name":"oldPassword"},{"type":{"names":["String"]},"description":"

A new password for the user. This is not sent in plain text over the wire.

","name":"newPassword"},{"type":{"names":["function"]},"optional":true,"description":"

Optional callback. Called with no arguments on success, or with a single Error argument on failure.

","name":"callback"}],"name":"changePassword","longname":"Accounts.changePassword","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Client"},"forgotPassword":{"summary":"Request a forgot password email.","params":[{"type":{"names":["Object"]},"name":"options"},{"type":{"names":["function"]},"optional":true,"description":"

Optional callback. Called with no arguments on success, or with a single Error argument on failure.

","name":"callback"}],"name":"forgotPassword","longname":"Accounts.forgotPassword","kind":"function","memberof":"Accounts","scope":"static","options":[{"type":{"names":["String"]},"description":"

The email address to send a password reset link.

","name":"email"}],"locus":"Client"},"resetPassword":{"summary":"Reset the password for a user using a token received in email. Logs the user in afterwards.","params":[{"type":{"names":["String"]},"description":"

The token retrieved from the reset password URL.

","name":"token"},{"type":{"names":["String"]},"description":"

A new password for the user. This is not sent in plain text over the wire.

","name":"newPassword"},{"type":{"names":["function"]},"optional":true,"description":"

Optional callback. Called with no arguments on success, or with a single Error argument on failure.

","name":"callback"}],"name":"resetPassword","longname":"Accounts.resetPassword","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Client"},"verifyEmail":{"summary":"Marks the user's email address as verified. Logs the user in afterwards.","params":[{"type":{"names":["String"]},"description":"

The token retrieved from the verification URL.

","name":"token"},{"type":{"names":["function"]},"optional":true,"description":"

Optional callback. Called with no arguments on success, or with a single Error argument on failure.

","name":"callback"}],"name":"verifyEmail","longname":"Accounts.verifyEmail","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Client"},"setPassword":{"summary":"Forcibly change the password for a user.","params":[{"type":{"names":["String"]},"description":"

The id of the user to update.

","name":"userId"},{"type":{"names":["String"]},"description":"

A new password for the user.

","name":"newPassword"}],"name":"setPassword","longname":"Accounts.setPassword","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Server"},"sendResetPasswordEmail":{"summary":"Send an email with a link the user can use to reset their password.","params":[{"type":{"names":["String"]},"description":"

The id of the user to send email to.

","name":"userId"},{"type":{"names":["String"]},"optional":true,"description":"

Optional. Which address of the user's to send the email to. This address must be in the user's emails list. Defaults to the first email in the list.

","name":"email"}],"name":"sendResetPasswordEmail","longname":"Accounts.sendResetPasswordEmail","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Server"},"sendEnrollmentEmail":{"summary":"Send an email with a link the user can use to set their initial password.","params":[{"type":{"names":["String"]},"description":"

The id of the user to send email to.

","name":"userId"},{"type":{"names":["String"]},"optional":true,"description":"

Optional. Which address of the user's to send the email to. This address must be in the user's emails list. Defaults to the first email in the list.

","name":"email"}],"name":"sendEnrollmentEmail","longname":"Accounts.sendEnrollmentEmail","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Server"},"sendVerificationEmail":{"summary":"Send an email with a link the user can use verify their email address.","params":[{"type":{"names":["String"]},"description":"

The id of the user to send email to.

","name":"userId"},{"type":{"names":["String"]},"optional":true,"description":"

Optional. Which address of the user's to send the email to. This address must be in the user's emails list. Defaults to the first unverified email in the list.

","name":"email"}],"name":"sendVerificationEmail","longname":"Accounts.sendVerificationEmail","kind":"function","memberof":"Accounts","scope":"static","options":[],"locus":"Server"}},"EJSON":{"kind":"namespace","summary":"Namespace for EJSON functions","name":"EJSON","longname":"EJSON","scope":"global","newBinary":{"summary":"Allocate a new buffer of binary data that EJSON can serialize.","params":[{"type":{"names":["Number"]},"description":"

The number of bytes of binary data to allocate.

","name":"size"}],"name":"newBinary","longname":"EJSON.newBinary","kind":"member","memberof":"EJSON","scope":"static","locus":"Anywhere"},"CustomType#typeName":{"kind":"function","name":"typeName","memberof":"EJSON.CustomType","summary":"Return the tag used to identify this type. This must match the tag used to register this type with [`EJSON.addType`](#ejson_add_type).","scope":"instance","longname":"EJSON.CustomType#typeName","options":[],"params":[],"locus":"Anywhere"},"CustomType#toJSONValue":{"kind":"function","name":"toJSONValue","memberof":"EJSON.CustomType","summary":"Serialize this instance into a JSON-compatible value.","scope":"instance","longname":"EJSON.CustomType#toJSONValue","options":[],"params":[],"locus":"Anywhere"},"CustomType#clone":{"kind":"function","name":"clone","memberof":"EJSON.CustomType","summary":"Return a value `r` such that `this.equals(r)` is true, and modifications to `r` do not affect `this` and vice versa.","scope":"instance","longname":"EJSON.CustomType#clone","options":[],"params":[],"locus":"Anywhere"},"CustomType#equals":{"kind":"function","name":"equals","memberof":"EJSON.CustomType","summary":"Return `true` if `other` has a value equal to `this`; `false` otherwise.","params":[{"type":{"names":["Object"]},"description":"

Another object to compare this to.

","name":"other"}],"scope":"instance","longname":"EJSON.CustomType#equals","options":[],"locus":"Anywhere"},"addType":{"summary":"Add a custom datatype to EJSON.","params":[{"type":{"names":["String"]},"description":"

A tag for your custom type; must be unique among custom data types defined in your project, and must match the result of your type's typeName method.

","name":"name"},{"type":{"names":["function"]},"description":"

A function that deserializes a JSON-compatible value into an instance of your type. This should match the serialization performed by your type's toJSONValue method.

","name":"factory"}],"name":"addType","longname":"EJSON.addType","kind":"function","memberof":"EJSON","scope":"static","options":[],"locus":"Anywhere"},"toJSONValue":{"summary":"Serialize an EJSON-compatible value into its plain JSON representation.","params":[{"type":{"names":["EJSON"]},"description":"

A value to serialize to plain JSON.

","name":"val"}],"name":"toJSONValue","longname":"EJSON.toJSONValue","kind":"function","memberof":"EJSON","scope":"static","options":[],"locus":"Anywhere"},"fromJSONValue":{"summary":"Deserialize an EJSON value from its plain JSON representation.","params":[{"type":{"names":["JSONCompatible"]},"description":"

A value to deserialize into EJSON.

","name":"val"}],"name":"fromJSONValue","longname":"EJSON.fromJSONValue","kind":"function","memberof":"EJSON","scope":"static","options":[],"locus":"Anywhere"},"stringify":{"summary":"Serialize a value to a string.\n\nFor EJSON values, the serialization fully represents the value. For non-EJSON values, serializes the same way as `JSON.stringify`.","params":[{"type":{"names":["EJSON"]},"description":"

A value to stringify.

","name":"val"},{"type":{"names":["Object"]},"optional":true,"name":"options"}],"name":"stringify","longname":"EJSON.stringify","kind":"function","memberof":"EJSON","scope":"static","options":[{"type":{"names":["Boolean","Integer","String"]},"description":"

Indents objects and arrays for easy readability. When true, indents by 2 spaces; when an integer, indents by that number of spaces; and when a string, uses the string as the indentation pattern.

","name":"indent"},{"type":{"names":["Boolean"]},"description":"

When true, stringifies keys in an object in sorted order.

","name":"canonical"}],"locus":"Anywhere"},"parse":{"summary":"Parse a string into an EJSON value. Throws an error if the string is not valid EJSON.","params":[{"type":{"names":["String"]},"description":"

A string to parse into an EJSON value.

","name":"str"}],"name":"parse","longname":"EJSON.parse","kind":"function","memberof":"EJSON","scope":"static","options":[],"locus":"Anywhere"},"isBinary":{"summary":"Returns true if `x` is a buffer of binary data, as returned from [`EJSON.newBinary`](#ejson_new_binary).","params":[{"type":{"names":["Object"]},"description":"

The variable to check.

","name":"x"}],"name":"isBinary","longname":"EJSON.isBinary","kind":"function","memberof":"EJSON","scope":"static","options":[],"locus":"Anywhere"},"equals":{"summary":"Return true if `a` and `b` are equal to each other. Return false otherwise. Uses the `equals` method on `a` if present, otherwise performs a deep comparison.","params":[{"type":{"names":["EJSON"]},"name":"a"},{"type":{"names":["EJSON"]},"name":"b"},{"type":{"names":["Object"]},"optional":true,"name":"options"}],"name":"equals","longname":"EJSON.equals","kind":"function","memberof":"EJSON","scope":"static","options":[{"type":{"names":["Boolean"]},"description":"

Compare in key sensitive order, if supported by the JavaScript implementation. For example, {a: 1, b: 2} is equal to {b: 2, a: 1} only when keyOrderSensitive is false. The default is false.

","name":"keyOrderSensitive"}],"locus":"Anywhere"},"clone":{"summary":"Return a deep copy of `val`.","params":[{"type":{"names":["EJSON"]},"description":"

A value to copy.

","name":"val"}],"name":"clone","longname":"EJSON.clone","kind":"function","memberof":"EJSON","scope":"static","options":[],"locus":"Anywhere"},"CustomType":{"kind":"class","name":"CustomType","memberof":"EJSON","summary":"The interface that a class must satisfy to be able to become an\nEJSON custom type via EJSON.addType.","scope":"static","longname":"EJSON.CustomType","options":[],"params":[],"instancename":"customType"}},"Meteor":{"summary":"The Meteor namespace","kind":"namespace","name":"Meteor","longname":"Meteor","users":{"summary":"A [Mongo.Collection](#collections) containing user documents.","name":"users","longname":"Meteor.users","kind":"member","memberof":"Meteor","scope":"static","locus":"Anywhere"},"isClient":{"summary":"Boolean variable. True if running in client environment.","scope":"static","name":"isClient","longname":"Meteor.isClient","kind":"member","memberof":"Meteor","locus":"Anywhere"},"isServer":{"summary":"Boolean variable. True if running in server environment.","scope":"static","name":"isServer","longname":"Meteor.isServer","kind":"member","memberof":"Meteor","locus":"Anywhere"},"settings":{"summary":"`Meteor.settings` contains deployment-specific configuration options. You can initialize settings by passing the `--settings` option (which takes the name of a file containing JSON data) to `meteor run` or `meteor deploy`. When running your server directly (e.g. from a bundle), you instead specify settings by putting the JSON directly into the `METEOR_SETTINGS` environment variable. If you don't provide any settings, `Meteor.settings` will be an empty object. If the settings object contains a key named `public`, then `Meteor.settings.public` will be available on the client as well as the server. All other properties of `Meteor.settings` are only defined on the server.","name":"settings","longname":"Meteor.settings","kind":"member","memberof":"Meteor","scope":"static","locus":"Anywhere"},"isCordova":{"summary":"Boolean variable. True if running in a Cordova mobile environment.","name":"isCordova","longname":"Meteor.isCordova","kind":"member","memberof":"Meteor","scope":"static","locus":"Anywhere"},"release":{"summary":"`Meteor.release` is a string containing the name of the [release](#meteorupdate) with which the project was built (for example, `\"1.2.3\"`). It is `undefined` if the project was built using a git checkout of Meteor.","name":"release","longname":"Meteor.release","kind":"member","memberof":"Meteor","scope":"static","locus":"Anywhere"},"userId":{"summary":"Get the current user id, or `null` if no user is logged in. A reactive data source.","name":"userId","longname":"Meteor.userId","kind":"function","memberof":"Meteor","scope":"static","options":[],"params":[],"locus":"Anywhere but publish functions"},"loggingIn":{"summary":"True if a login method (such as `Meteor.loginWithPassword`, `Meteor.loginWithFacebook`, or `Accounts.createUser`) is currently in progress. A reactive data source.","name":"loggingIn","longname":"Meteor.loggingIn","kind":"function","memberof":"Meteor","scope":"static","options":[],"params":[],"locus":"Client"},"user":{"summary":"Get the current user record, or `null` if no user is logged in. A reactive data source.","name":"user","longname":"Meteor.user","kind":"function","memberof":"Meteor","scope":"static","options":[],"params":[],"locus":"Anywhere but publish functions"},"logout":{"summary":"Log the user out.","params":[{"type":{"names":["function"]},"optional":true,"description":"

Optional callback. Called with no arguments on success, or with a single Error argument on failure.

","name":"callback"}],"name":"logout","longname":"Meteor.logout","kind":"function","memberof":"Meteor","scope":"static","options":[],"locus":"Client"},"logoutOtherClients":{"summary":"Log out other clients logged in as the current user, but does not log out the client that calls this function.","params":[{"type":{"names":["function"]},"optional":true,"description":"

Optional callback. Called with no arguments on success, or with a single Error argument on failure.

","name":"callback"}],"name":"logoutOtherClients","longname":"Meteor.logoutOtherClients","kind":"function","memberof":"Meteor","scope":"static","options":[],"locus":"Client"},"loginWith":{"name":"loginWith","memberof":"Meteor","kind":"function","summary":"Log the user in using an external service.","params":[{"type":{"names":["Object"]},"optional":true,"name":"options"},{"type":{"names":["function"]},"optional":true,"description":"

Optional callback. Called with no arguments on success, or with a single Error argument on failure.

","name":"callback"}],"scope":"static","longname":"Meteor.loginWith","options":[{"type":{"names":["Array."]},"description":"

A list of permissions to request from the user.

","name":"requestPermissions"},{"type":{"names":["Boolean"]},"description":"

If true, asks the user for permission to act on their behalf when offline. This stores an additional offline token in the services field of the user document. Currently only supported with Google.

","name":"requestOfflineToken"},{"type":{"names":["Boolean"]},"description":"

If true, forces the user to approve the app's permissions, even if previously approved. Currently only supported with Google.

","name":"forceApprovalPrompt"},{"type":{"names":["String"]},"description":"

An email address that the external service will use to pre-fill the login prompt. Currently only supported with Meteor developer accounts.

","name":"userEmail"},{"type":{"names":["String"]},"description":"

Login style ("popup" or "redirect", defaults to the login service configuration). The "popup" style opens the login page in a separate popup window, which is generally preferred because the Meteor application doesn't need to be reloaded. The "redirect" style redirects the Meteor application's window to the login page, and the login service provider redirects back to the Meteor application which is then reloaded. The "redirect" style can be used in situations where a popup window can't be opened, such as in a mobile UIWebView. The "redirect" style however relies on session storage which isn't available in Safari private mode, so the "popup" style will be forced if session storage can't be used.

","name":"loginStyle"}],"locus":"Client"},"loginWithPassword":{"summary":"Log the user in with a password.","params":[{"type":{"names":["Object","String"]},"description":"

Either a string interpreted as a username or an email; or an object with a single key: email, username or id.

","name":"user"},{"type":{"names":["String"]},"description":"

The user's password.

","name":"password"},{"type":{"names":["function"]},"optional":true,"description":"

Optional callback. Called with no arguments on success, or with a single Error argument on failure.

","name":"callback"}],"name":"loginWithPassword","longname":"Meteor.loginWithPassword","kind":"function","memberof":"Meteor","scope":"static","options":[],"locus":"Client"},"subscribe":{"memberof":"Meteor","summary":"Subscribe to a record set. Returns a handle that provides `stop()` and `ready()` methods.","params":[{"type":{"names":["String"]},"description":"

Name of the subscription. Matches the name of the server's publish() call.

","name":"name"},{"type":{"names":["Any"]},"optional":true,"description":"

Optional arguments passed to publisher function on server.

","name":"arg1, arg2..."},{"type":{"names":["function","Object"]},"optional":true,"description":"

Optional. May include onError and onReady callbacks. If a function is passed instead of an object, it is interpreted as an onReady callback.

","name":"callbacks"}],"name":"subscribe","longname":"Meteor.subscribe","kind":"function","scope":"static","options":[],"locus":"Client"},"call":{"memberof":"Meteor","summary":"Invokes a method passing any number of arguments.","params":[{"type":{"names":["String"]},"description":"

Name of method to invoke

","name":"name"},{"type":{"names":["EJSONable"]},"optional":true,"description":"

Optional method arguments

","name":"arg1, arg2..."},{"type":{"names":["function"]},"optional":true,"description":"

Optional callback, which is called asynchronously with the error or result after the method is complete. If not provided, the method runs synchronously if possible (see below).

","name":"asyncCallback"}],"name":"call","longname":"Meteor.call","kind":"function","scope":"static","options":[],"locus":"Anywhere"},"apply":{"memberof":"Meteor","summary":"Invoke a method passing an array of arguments.","params":[{"type":{"names":["String"]},"description":"

Name of method to invoke

","name":"name"},{"type":{"names":["Array."]},"description":"

Method arguments

","name":"args"},{"type":{"names":["Object"]},"optional":true,"name":"options"},{"type":{"names":["function"]},"optional":true,"description":"

Optional callback; same semantics as in Meteor.call.

","name":"asyncCallback"}],"name":"apply","longname":"Meteor.apply","kind":"function","scope":"static","options":[{"type":{"names":["Boolean"]},"description":"

(Client only) If true, don't send this method until all previous method calls have completed, and don't send any subsequent method calls until this one is completed.

","name":"wait"},{"type":{"names":["function"]},"description":"

(Client only) This callback is invoked with the error or result of the method (just like asyncCallback) as soon as the error or result is available. The local cache may not yet reflect the writes performed by the method.

","name":"onResultReceived"}],"locus":"Anywhere"},"status":{"summary":"Get the current connection status. A reactive data source.","memberof":"Meteor","name":"status","longname":"Meteor.status","kind":"function","scope":"static","options":[],"params":[],"locus":"Client"},"reconnect":{"summary":"Force an immediate reconnection attempt if the client is not connected to the server.\n\n This method does nothing if the client is already connected.","memberof":"Meteor","name":"reconnect","longname":"Meteor.reconnect","kind":"function","scope":"static","options":[],"params":[],"locus":"Client"},"disconnect":{"summary":"Disconnect the client from the server.","memberof":"Meteor","name":"disconnect","longname":"Meteor.disconnect","kind":"function","scope":"static","options":[],"params":[],"locus":"Client"},"onConnection":{"summary":"Register a callback to be called when a new DDP connection is made to the server.","params":[{"type":{"names":["function"]},"description":"

The function to call when a new DDP connection is established.

","name":"callback"}],"memberof":"Meteor","name":"onConnection","longname":"Meteor.onConnection","kind":"function","scope":"static","options":[],"locus":"Server"},"publish":{"summary":"Publish a record set.","memberof":"Meteor","params":[{"type":{"names":["String"]},"description":"

Name of the record set. If null, the set has no name, and the record set is automatically sent to all connected clients.

","name":"name"},{"type":{"names":["function"]},"description":"

Function called on the server each time a client subscribes. Inside the function, this is the publish handler object, described below. If the client passed arguments to subscribe, the function is called with the same arguments.

","name":"func"}],"name":"publish","longname":"Meteor.publish","kind":"function","scope":"static","options":[],"locus":"Server"},"methods":{"summary":"Defines functions that can be invoked over the network by clients.","params":[{"type":{"names":["Object"]},"description":"

Dictionary whose keys are method names and values are functions.

","name":"methods"}],"memberof":"Meteor","name":"methods","longname":"Meteor.methods","kind":"function","scope":"static","options":[],"locus":"Anywhere"},"wrapAsync":{"memberof":"Meteor","summary":"Wrap a function that takes a callback function as its final parameter. On the server, the wrapped function can be used either synchronously (without passing a callback) or asynchronously (when a callback is passed). On the client, a callback is always required; errors will be logged if there is no callback. If a callback is provided, the environment captured when the original function was called will be restored in the callback.","params":[{"type":{"names":["function"]},"description":"

A function that takes a callback as its final parameter

","name":"func"},{"type":{"names":["Object"]},"optional":true,"description":"

Optional this object against which the original function will be invoked

","name":"context"}],"name":"wrapAsync","longname":"Meteor.wrapAsync","kind":"function","scope":"static","options":[],"locus":"Anywhere"},"startup":{"summary":"Run code when a client or a server starts.","params":[{"type":{"names":["function"]},"description":"

A function to run on startup.

","name":"func"}],"name":"startup","longname":"Meteor.startup","kind":"function","memberof":"Meteor","scope":"static","options":[],"locus":"Anywhere"},"setTimeout":{"memberof":"Meteor","summary":"Call a function in the future after waiting for a specified delay.","params":[{"type":{"names":["function"]},"description":"

The function to run

","name":"func"},{"type":{"names":["Number"]},"description":"

Number of milliseconds to wait before calling function

","name":"delay"}],"name":"setTimeout","longname":"Meteor.setTimeout","kind":"function","scope":"static","options":[],"locus":"Anywhere"},"setInterval":{"memberof":"Meteor","summary":"Call a function repeatedly, with a time delay between calls.","params":[{"type":{"names":["function"]},"description":"

The function to run

","name":"func"},{"type":{"names":["Number"]},"description":"

Number of milliseconds to wait between each function call.

","name":"delay"}],"name":"setInterval","longname":"Meteor.setInterval","kind":"function","scope":"static","options":[],"locus":"Anywhere"},"clearInterval":{"memberof":"Meteor","summary":"Cancel a repeating function call scheduled by `Meteor.setInterval`.","params":[{"type":{"names":["Number"]},"description":"

The handle returned by Meteor.setInterval

","name":"id"}],"name":"clearInterval","longname":"Meteor.clearInterval","kind":"function","scope":"static","options":[],"locus":"Anywhere"},"clearTimeout":{"memberof":"Meteor","summary":"Cancel a function call scheduled by `Meteor.setTimeout`.","params":[{"type":{"names":["Number"]},"description":"

The handle returned by Meteor.setTimeout

","name":"id"}],"name":"clearTimeout","longname":"Meteor.clearTimeout","kind":"function","scope":"static","options":[],"locus":"Anywhere"},"absoluteUrl":{"summary":"Generate an absolute URL pointing to the application. The server reads from the `ROOT_URL` environment variable to determine where it is running. This is taken care of automatically for apps deployed with `meteor deploy`, but must be provided when using `meteor bundle`.","params":[{"type":{"names":["String"]},"optional":true,"description":"

A path to append to the root URL. Do not include a leading "/".

","name":"path"},{"type":{"names":["Object"]},"optional":true,"name":"options"}],"name":"absoluteUrl","longname":"Meteor.absoluteUrl","kind":"function","memberof":"Meteor","scope":"static","options":[{"type":{"names":["Boolean"]},"description":"

Create an HTTPS URL.

","name":"secure"},{"type":{"names":["Boolean"]},"description":"

Replace localhost with 127.0.0.1. Useful for services that don't recognize localhost as a domain name.

","name":"replaceLocalhost"},{"type":{"names":["String"]},"description":"

Override the default ROOT_URL from the server environment. For example: "http://foo.example.com"

","name":"rootUrl"}],"locus":"Anywhere"},"Error":{"summary":"This class represents a symbolic error thrown by a method.","kind":"class","params":[{"type":{"names":["String"]},"description":"

A string code uniquely identifying this kind of error.\nThis string should be used by callers of the method to determine the\nappropriate action to take, instead of attempting to parse the reason\nor details fields. For example:

\n
// on the server, pick a code unique to this error\n// the reason field should be a useful debug message\nthrow new Meteor.Error("logged-out", \n  "The user must be logged in to post a comment.");\n\n// on the client\nMeteor.call("methodName", function (error) {\n  // identify the error\n  if (error.error === "logged-out") {\n    // show a nice error message\n    Session.set("errorMessage", "Please log in to post a comment.");\n  }\n});

For legacy reasons, some built-in Meteor functions such as check throw\nerrors with a number in this field.

","name":"error"},{"type":{"names":["String"]},"optional":true,"description":"

Optional. A short human-readable summary of the\nerror, like 'Not Found'.

","name":"reason"},{"type":{"names":["String"]},"optional":true,"description":"

Optional. Additional information about the error,\nlike a textual stack trace.

","name":"details"}],"name":"Error","longname":"Meteor.Error","memberof":"Meteor","scope":"static","options":[],"locus":"Anywhere"}},"Mongo":{"summary":"Namespace for MongoDB-related items","kind":"namespace","name":"Mongo","longname":"Mongo","scope":"global","Cursor#forEach":{"summary":"Call `callback` once for each matching document, sequentially and synchronously.","kind":"function","name":"forEach","scope":"instance","memberof":"Mongo.Cursor","params":[{"type":{"names":["function"]},"description":"

Function to call. It will be called with three arguments: the document, a 0-based index, and cursor itself.

","name":"callback"},{"type":{"names":["Any"]},"optional":true,"description":"

An object which will be the value of this inside callback.

","name":"thisArg"}],"longname":"Mongo.Cursor#forEach","options":[],"locus":"Anywhere"},"Cursor#map":{"summary":"Map callback over all matching documents. Returns an Array.","kind":"function","name":"map","scope":"instance","memberof":"Mongo.Cursor","params":[{"type":{"names":["function"]},"description":"

Function to call. It will be called with three arguments: the document, a 0-based index, and cursor itself.

","name":"callback"},{"type":{"names":["Any"]},"optional":true,"description":"

An object which will be the value of this inside callback.

","name":"thisArg"}],"longname":"Mongo.Cursor#map","options":[],"locus":"Anywhere"},"Cursor#fetch":{"summary":"Return all matching documents as an Array.","memberof":"Mongo.Cursor","kind":"function","name":"fetch","scope":"instance","longname":"Mongo.Cursor#fetch","options":[],"params":[],"locus":"Anywhere"},"Cursor#count":{"summary":"Returns the number of documents that match a query.","memberof":"Mongo.Cursor","kind":"function","name":"count","scope":"instance","longname":"Mongo.Cursor#count","options":[],"params":[],"locus":"Anywhere"},"Cursor#observe":{"summary":"Watch a query. Receive callbacks as the result set changes.","memberof":"Mongo.Cursor","scope":"instance","params":[{"type":{"names":["Object"]},"description":"

Functions to call to deliver the result set as it changes

","name":"callbacks"}],"name":"observe","longname":"Mongo.Cursor#observe","kind":"function","options":[],"locus":"Anywhere"},"Cursor#observeChanges":{"summary":"Watch a query. Receive callbacks as the result set changes. Only the differences between the old and new documents are passed to the callbacks.","memberof":"Mongo.Cursor","scope":"instance","params":[{"type":{"names":["Object"]},"description":"

Functions to call to deliver the result set as it changes

","name":"callbacks"}],"name":"observeChanges","longname":"Mongo.Cursor#observeChanges","kind":"function","options":[],"locus":"Anywhere"},"Collection#insert":{"summary":"Insert a document in the collection. Returns its unique _id.","kind":"function","name":"insert","memberof":"Mongo.Collection","scope":"instance","params":[{"type":{"names":["Object"]},"description":"

The document to insert. May not yet have an _id attribute, in which case Meteor will generate one for you.

","name":"doc"},{"type":{"names":["function"]},"optional":true,"description":"

Optional. If present, called with an error object as the first argument and, if no error, the _id as the second.

","name":"callback"}],"longname":"Mongo.Collection#insert","options":[],"locus":"Anywhere"},"Collection#update":{"summary":"Modify one or more documents in the collection. Returns the number of affected documents.","kind":"function","name":"update","memberof":"Mongo.Collection","scope":"instance","params":[{"type":{"names":["MongoSelector"]},"description":"

Specifies which documents to modify

","name":"selector"},{"type":{"names":["MongoModifier"]},"description":"

Specifies how to modify the documents

","name":"modifier"},{"type":{"names":["Object"]},"optional":true,"name":"options"},{"type":{"names":["function"]},"optional":true,"description":"

Optional. If present, called with an error object as the first argument and, if no error, the number of affected documents as the second.

","name":"callback"}],"longname":"Mongo.Collection#update","options":[{"type":{"names":["Boolean"]},"description":"

True to modify all matching documents; false to only modify one of the matching documents (the default).

","name":"multi"},{"type":{"names":["Boolean"]},"description":"

True to insert a document if no matching documents are found.

","name":"upsert"}],"locus":"Anywhere"},"Collection#find":{"summary":"Find the documents in a collection that match the selector.","kind":"function","name":"find","memberof":"Mongo.Collection","scope":"instance","params":[{"type":{"names":["MongoSelector"]},"optional":true,"description":"

A query describing the documents to find

","name":"selector"},{"type":{"names":["Object"]},"optional":true,"name":"options"}],"longname":"Mongo.Collection#find","options":[{"type":{"names":["MongoSortSpecifier"]},"description":"

Sort order (default: natural order)

","name":"sort"},{"type":{"names":["Number"]},"description":"

Number of results to skip at the beginning

","name":"skip"},{"type":{"names":["Number"]},"description":"

Maximum number of results to return

","name":"limit"},{"type":{"names":["MongoFieldSpecifier"]},"description":"

Dictionary of fields to return or exclude.

","name":"fields"},{"type":{"names":["Boolean"]},"description":"

(Client only) Default true; pass false to disable reactivity

","name":"reactive"},{"type":{"names":["function"]},"description":"

Overrides transform on the Collection for this cursor. Pass null to disable transformation.

","name":"transform"}],"locus":"Anywhere"},"Collection#findOne":{"summary":"Finds the first document that matches the selector, as ordered by sort and skip options.","kind":"function","name":"findOne","memberof":"Mongo.Collection","scope":"instance","params":[{"type":{"names":["MongoSelector"]},"optional":true,"description":"

A query describing the documents to find

","name":"selector"},{"type":{"names":["Object"]},"optional":true,"name":"options"}],"longname":"Mongo.Collection#findOne","options":[{"type":{"names":["MongoSortSpecifier"]},"description":"

Sort order (default: natural order)

","name":"sort"},{"type":{"names":["Number"]},"description":"

Number of results to skip at the beginning

","name":"skip"},{"type":{"names":["MongoFieldSpecifier"]},"description":"

Dictionary of fields to return or exclude.

","name":"fields"},{"type":{"names":["Boolean"]},"description":"

(Client only) Default true; pass false to disable reactivity

","name":"reactive"},{"type":{"names":["function"]},"description":"

Overrides transform on the Collection for this cursor. Pass null to disable transformation.

","name":"transform"}],"locus":"Anywhere"},"Collection#remove":{"summary":"Remove documents from the collection","kind":"function","name":"remove","memberof":"Mongo.Collection","scope":"instance","params":[{"type":{"names":["MongoSelector"]},"description":"

Specifies which documents to remove

","name":"selector"},{"type":{"names":["function"]},"optional":true,"description":"

Optional. If present, called with an error object as its argument.

","name":"callback"}],"longname":"Mongo.Collection#remove","options":[],"locus":"Anywhere"},"Collection#upsert":{"summary":"Modify one or more documents in the collection, or insert one if no matching documents were found. Returns an object with keys `numberAffected` (the number of documents modified) and `insertedId` (the unique _id of the document that was inserted, if any).","params":[{"type":{"names":["MongoSelector"]},"description":"

Specifies which documents to modify

","name":"selector"},{"type":{"names":["MongoModifier"]},"description":"

Specifies how to modify the documents

","name":"modifier"},{"type":{"names":["Object"]},"optional":true,"name":"options"},{"type":{"names":["function"]},"optional":true,"description":"

Optional. If present, called with an error object as the first argument and, if no error, the number of affected documents as the second.

","name":"callback"}],"name":"upsert","longname":"Mongo.Collection#upsert","kind":"function","memberof":"Mongo.Collection","scope":"instance","options":[{"type":{"names":["Boolean"]},"description":"

True to modify all matching documents; false to only modify one of the matching documents (the default).

","name":"multi"}],"locus":"Anywhere"},"Collection#allow":{"summary":"Allow users to write directly to this collection from client code, subject to limitations you define.","params":[{"type":{"names":["Object"]},"name":"options"}],"name":"allow","longname":"Mongo.Collection#allow","kind":"function","memberof":"Mongo.Collection","scope":"instance","options":[{"type":{"names":["function"]},"description":"

Functions that look at a proposed modification to the database and return true if it should be allowed.

","name":"insert, update, remove"},{"type":{"names":["Array."]},"description":"

Optional performance enhancement. Limits the fields that will be fetched from the database for inspection by your update and remove functions.

","name":"fetch"},{"type":{"names":["function"]},"description":"

Overrides transform on the Collection. Pass null to disable transformation.

","name":"transform"}],"locus":"Server"},"Collection#deny":{"summary":"Override `allow` rules.","params":[{"type":{"names":["Object"]},"name":"options"}],"name":"deny","longname":"Mongo.Collection#deny","kind":"function","memberof":"Mongo.Collection","scope":"instance","options":[{"type":{"names":["function"]},"description":"

Functions that look at a proposed modification to the database and return true if it should be denied, even if an allow rule says otherwise.

","name":"insert, update, remove"},{"type":{"names":["Array."]},"description":"

Optional performance enhancement. Limits the fields that will be fetched from the database for inspection by your update and remove functions.

","name":"fetch"},{"type":{"names":["function"]},"description":"

Overrides transform on the Collection. Pass null to disable transformation.

","name":"transform"}],"locus":"Server"},"Collection":{"summary":"Constructor for a Collection","kind":"class","params":[{"type":{"names":["String"]},"description":"

The name of the collection. If null, creates an unmanaged (unsynchronized) local collection.

","name":"name"},{"type":{"names":["Object"]},"optional":true,"name":"options"}],"name":"Collection","longname":"Mongo.Collection","memberof":"Mongo","scope":"static","options":[{"type":{"names":["Object"]},"description":"

The server connection that will manage this collection. Uses the default connection if not specified. Pass the return value of calling DDP.connect to specify a different server. Pass null to specify no connection. Unmanaged (name is null) collections cannot specify a connection.

","name":"connection"},{"type":{"names":["String"]},"description":"

The method of generating the _id fields of new documents in this collection. Possible values:

\n\n

The default id generation technique is 'STRING'.

","name":"idGeneration"},{"type":{"names":["function"]},"description":"

An optional transformation function. Documents will be passed through this function before being returned from fetch or findOne, and before being passed to callbacks of observe, map, forEach, allow, and deny. Transforms are not applied for the callbacks of observeChanges or to cursors returned from publish functions.

","name":"transform"}],"locus":"Anywhere","instancename":"collection"},"ObjectID":{"summary":"Create a Mongo-style `ObjectID`. If you don't specify a `hexString`, the `ObjectID` will generated randomly (not using MongoDB's ID construction rules).","kind":"class","params":[{"type":{"names":["String"]},"description":"

Optional. The 24-character hexadecimal contents of the ObjectID to create

","name":"hexString"}],"name":"ObjectID","longname":"Mongo.ObjectID","memberof":"Mongo","scope":"static","options":[],"locus":"Anywhere"},"Cursor":{"summary":"To create a cursor, use find. To access the documents in a cursor, use forEach, map, or fetch.","kind":"class","name":"Cursor","longname":"Mongo.Cursor","memberof":"Mongo","scope":"static","options":[],"params":[],"instancename":"cursor"}},"Assets":{"summary":"The namespace for Assets functions, lives in the bundler.","kind":"namespace","name":"Assets","longname":"Assets","getText":{"summary":"Retrieve the contents of the static server asset as a UTF8-encoded string.","memberof":"Assets","params":[{"type":{"names":["String"]},"description":"

The path of the asset, relative to the application's private subdirectory.

","name":"assetPath"},{"type":{"names":["function"]},"optional":true,"description":"

Optional callback, which is called asynchronously with the error or result after the function is complete. If not provided, the function runs synchronously.

","name":"asyncCallback"}],"name":"getText","longname":"Assets.getText","kind":"function","scope":"static","options":[],"locus":"Server"},"getBinary":{"summary":"Retrieve the contents of the static server asset as an [EJSON Binary](#ejson_new_binary).","memberof":"Assets","params":[{"type":{"names":["String"]},"description":"

The path of the asset, relative to the application's private subdirectory.

","name":"assetPath"},{"type":{"names":["function"]},"optional":true,"description":"

Optional callback, which is called asynchronously with the error or result after the function is complete. If not provided, the function runs synchronously.

","name":"asyncCallback"}],"name":"getBinary","longname":"Assets.getBinary","kind":"function","scope":"static","options":[],"locus":"Server"}},"App":{"kind":"namespace","name":"App","scope":"global","summary":"The App configuration object in mobile-config.js","longname":"App","info":{"summary":"Set your mobile app's core configuration information.","params":[{"type":{"names":["Object"]},"name":"options"}],"memberof":"App","name":"info","longname":"App.info","kind":"function","scope":"static","options":[{"type":{"names":["String"]},"optional":true,"description":"

Each of the options correspond to a key in the app's core configuration\nas described in the PhoneGap documentation.

","name":"id, version, name, description, author, email, website"}]},"setPreference":{"summary":"Add a preference for your build as described in the\n[PhoneGap documentation](http://docs.phonegap.com/en/3.5.0/config_ref_index.md.html#The%20config.xml%20File_global_preferences).","params":[{"type":{"names":["String"]},"description":"

A preference name supported by Phonegap's\nconfig.xml.

","name":"name"},{"type":{"names":["String"]},"description":"

The value for that preference.

","name":"value"}],"memberof":"App","name":"setPreference","longname":"App.setPreference","kind":"function","scope":"static","options":[]},"configurePlugin":{"summary":"Set the build-time configuration for a Phonegap plugin.","params":[{"type":{"names":["String"]},"description":"

The identifier of the plugin you want to\nconfigure.

","name":"pluginName"},{"type":{"names":["Object"]},"description":"

A set of key-value pairs which will be passed\nat build-time to configure the specified plugin.

","name":"config"}],"memberof":"App","name":"configurePlugin","longname":"App.configurePlugin","kind":"function","scope":"static","options":[]},"icons":{"summary":"Set the icons for your mobile app.","params":[{"type":{"names":["Object"]},"description":"

An Object where the keys are different\ndevices and screen sizes, and values are image paths\nrelative to the project root directory.

\n

Valid key values:

\n
    \n
  • iphone
  • \n
  • iphone_2x
  • \n
  • iphone_3x
  • \n
  • ipad
  • \n
  • ipad_2x
  • \n
  • android_ldpi
  • \n
  • android_mdpi
  • \n
  • android_hdpi
  • \n
  • android_xhdpi
  • \n
","name":"icons"}],"memberof":"App","name":"icons","longname":"App.icons","kind":"function","scope":"static","options":[]},"launchScreens":{"summary":"Set the launch screen images for your mobile app.","params":[{"type":{"names":["Object"]},"description":"

A dictionary where keys are different\ndevices, screen sizes, and orientations, and the values are image paths\nrelative to the project root directory.

\n

For Android, launch screen images should\nbe special "Nine-patch" image files that specify how they should be\nstretched. See the Android docs.

\n

Valid key values:

\n
    \n
  • iphone
  • \n
  • iphone_2x
  • \n
  • iphone5
  • \n
  • iphone6
  • \n
  • iphone6p_portrait
  • \n
  • iphone6p_landscape
  • \n
  • ipad_portrait
  • \n
  • ipad_portrait_2x
  • \n
  • ipad_landscape
  • \n
  • ipad_landscape_2x
  • \n
  • android_ldpi_portrait
  • \n
  • android_ldpi_landscape
  • \n
  • android_mdpi_portrait
  • \n
  • android_mdpi_landscape
  • \n
  • android_hdpi_portrait
  • \n
  • android_hdpi_landscape
  • \n
  • android_xhdpi_portrait
  • \n
  • android_xhdpi_landscape
  • \n
","name":"launchScreens"}],"memberof":"App","name":"launchScreens","longname":"App.launchScreens","kind":"function","scope":"static","options":[]}},"Plugin":{"scope":"global","kind":"namespace","name":"Plugin","summary":"The namespace that is exposed inside build plugin files.","longname":"Plugin","registerSourceHandler":{"summary":"Inside a build plugin source file specified in\n[Package.registerBuildPlugin](#Package-registerBuildPlugin),\nadd a handler to compile files with a certain file extension.","params":[{"type":{"names":["String"]},"description":"

The file extension that this plugin\nshould handle, without the first dot.\nExamples: "coffee", "coffee.md".

","name":"fileExtension"},{"type":{"names":["function"]},"description":"

A function that takes one argument,\na CompileStep object.

\n

Documentation for CompileStep is available on the GitHub Wiki.

","name":"handler"}],"memberof":"Plugin","name":"registerSourceHandler","longname":"Plugin.registerSourceHandler","kind":"function","scope":"static","options":[],"locus":"Build Plugin"}},"Package":{"scope":"global","name":"Package","summary":"The Package object in package.js","kind":"namespace","longname":"Package","locus":"package.js","describe":{"summary":"Provide basic package information.","memberof":"Package","params":[{"type":{"names":["Object"]},"name":"options"}],"name":"describe","longname":"Package.describe","kind":"function","scope":"static","options":[{"type":{"names":["String"]},"description":"

A concise 1-2 sentence description of\nthe package, required for publication.

","name":"summary"},{"type":{"names":["String"]},"description":"

The (extended)\nsemver version for your package. Additionally,\nMeteor allows a wrap number: a positive integer that follows the version number. If you are\nporting another package that uses semver versioning, you may want to\nuse the original version, postfixed with _wrapnumber. For example,\n1.2.3_1 or 2.4.5-rc1_4. Wrap numbers sort after the original numbers:\n1.2.3 < 1.2.3_1 < 1.2.3_2 < 1.2.4-rc.0. If no version is specified,\nthis field defaults to 0.0.0. If you want to publish your package to\nthe package server, you must specify a version.

","name":"version"},{"type":{"names":["String"]},"description":"

Optional name override. By default, the\npackage name comes from the name of its directory.

","name":"name"},{"type":{"names":["String"]},"description":"

Optional Git URL to the source repository.

","name":"git"}],"locus":"package.js"},"onUse":{"summary":"Define package dependencies and expose package methods.","memberof":"Package","params":[{"type":{"names":["function"]},"description":"

A function that takes in the package control 'api' object, which keeps track of dependencies and exports.

","name":"func"}],"name":"onUse","longname":"Package.onUse","kind":"function","scope":"static","options":[],"locus":"package.js"},"onTest":{"summary":"Define dependencies and expose package methods for unit tests.","memberof":"Package","params":[{"type":{"names":["function"]},"description":"

A function that takes in the package control 'api' object, which keeps track of dependencies and exports.

","name":"func"}],"name":"onTest","longname":"Package.onTest","kind":"function","scope":"static","options":[],"locus":"package.js"},"registerBuildPlugin":{"summary":"Define a build plugin. A build plugin extends the build\nprocess for apps and packages that use this package. For example,\nthe `coffeescript` package uses a build plugin to compile CoffeeScript\nsource files into JavaScript.","params":[{"type":{"names":["Object"]},"optional":true,"name":"options"}],"memberof":"Package","name":"registerBuildPlugin","longname":"Package.registerBuildPlugin","kind":"function","scope":"static","options":[{"type":{"names":["String"]},"description":"

A cosmetic name, must be unique in the\npackage.

","name":"name"},{"type":{"names":["String","Array."]},"description":"

Meteor packages that this\nplugin uses, independent of the packages specified in\napi.onUse.

","name":"use"},{"type":{"names":["Array."]},"description":"

The source files that make up the\nbuild plugin, independent from api.addFiles.

","name":"sources"},{"type":{"names":["Object"]},"description":"

An object where the keys\nare NPM package names, and the keys are the version numbers of\nrequired NPM packages, just like in Npm.depends.

","name":"npmDependencies"}],"locus":"package.js"}},"Npm":{"kind":"namespace","name":"Npm","scope":"global","summary":"The Npm object in package.js and package source files.","longname":"Npm","depends":{"summary":"Specify which [NPM](https://www.npmjs.org/) packages\nyour Meteor package depends on.","params":[{"type":{"names":["Object"]},"description":"

An object where the keys are package\nnames and the values are version numbers in string form.\nYou can only depend on exact versions of NPM packages. Example:

\n
Npm.depends({moment: "2.8.3"});
","name":"dependencies"}],"memberof":"Npm","name":"depends","longname":"Npm.depends","kind":"function","scope":"static","options":[],"locus":"package.js"},"require":{"summary":"Require a package that was specified using\n`Npm.depends()`.","params":[{"type":{"names":["String"]},"description":"

The name of the package to require.

","name":"name"}],"memberof":"Npm","name":"require","longname":"Npm.require","kind":"function","scope":"static","options":[],"locus":"Server"}},"Cordova":{"kind":"namespace","name":"Cordova","scope":"global","summary":"The Cordova object in package.js.","longname":"Cordova","depends":{"summary":"Specify which [Cordova / PhoneGap](http://cordova.apache.org/)\nplugins your Meteor package depends on.\n\nPlugins are installed from\n[plugins.cordova.io](http://plugins.cordova.io/), so the plugins and\nversions specified must exist there. Alternatively, the version\ncan be replaced with a GitHub tarball URL as described in the\n[Cordova / PhoneGap](https://github.com/meteor/meteor/wiki/Meteor-Cordova-Phonegap-integration#meteor-packages-with-cordovaphonegap-dependencies)\npage of the Meteor wiki on GitHub.","params":[{"type":{"names":["Object"]},"description":"

An object where the keys are plugin\nnames and the values are version numbers or GitHub tarball URLs\nin string form.\nExample:

\n
Cordova.depends({\n  "org.apache.cordova.camera": "0.3.0"\n});

Alternatively, with a GitHub URL:

\n
Cordova.depends({\n  "org.apache.cordova.camera":\n    "https://github.com/apache/cordova-plugin-camera/tarball/d84b875c"\n});
","name":"dependencies"}],"memberof":"Cordova","name":"depends","longname":"Cordova.depends","kind":"function","scope":"static","options":[],"locus":"package.js"}},"currentUser":{"scope":"global","name":"currentUser","summary":"Calls [Meteor.user()](#meteor_user). Use `{{#if currentUser}}` to check whether the user is logged in.","longname":"currentUser","kind":"member","ishelper":"true"},"loggingIn":{"scope":"global","name":"loggingIn","summary":"Calls [Meteor.loggingIn()](#meteor_loggingin).","longname":"loggingIn","kind":"member","ishelper":"true"},"Template#created":{"name":"created","scope":"instance","memberof":"Template","summary":"Provide a callback when an instance of a template is created.","longname":"Template#created","kind":"member","locus":"Client"},"Template#rendered":{"name":"rendered","scope":"instance","memberof":"Template","summary":"Provide a callback when an instance of a template is rendered.","longname":"Template#rendered","kind":"member","locus":"Client"},"Template#destroyed":{"name":"destroyed","scope":"instance","memberof":"Template","summary":"Provide a callback when an instance of a template is destroyed.","longname":"Template#destroyed","kind":"member","locus":"Client"},"Blaze":{"TemplateInstance#data":{"scope":"instance","memberof":"Blaze.TemplateInstance","name":"data","summary":"The data context of this instance's latest invocation.","longname":"Blaze.TemplateInstance#data","kind":"member","locus":"Client"},"TemplateInstance#view":{"name":"view","memberof":"Blaze.TemplateInstance","scope":"instance","summary":"The [View](#blaze_view) object for this invocation of the template.","longname":"Blaze.TemplateInstance#view","kind":"member","locus":"Client"},"TemplateInstance#firstNode":{"name":"firstNode","memberof":"Blaze.TemplateInstance","scope":"instance","summary":"The first top-level DOM node in this template instance.","longname":"Blaze.TemplateInstance#firstNode","kind":"member","locus":"Client"},"TemplateInstance#lastNode":{"name":"lastNode","memberof":"Blaze.TemplateInstance","scope":"instance","summary":"The last top-level DOM node in this template instance.","longname":"Blaze.TemplateInstance#lastNode","kind":"member","locus":"Client"},"currentView":{"summary":"The View corresponding to the current template helper, event handler, callback, or autorun. If there isn't one, `null`.","name":"currentView","longname":"Blaze.currentView","kind":"member","memberof":"Blaze","scope":"static","locus":"Client"},"With":{"summary":"Constructs a View that renders content with a data context.","params":[{"type":{"names":["Object","function"]},"description":"

An object to use as the data context, or a function returning such an object. If a function is provided, it will be reactively re-run.

","name":"data"},{"type":{"names":["function"]},"description":"

A Function that returns renderable content.

","name":"contentFunc"}],"name":"With","longname":"Blaze.With","kind":"function","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"If":{"summary":"Constructs a View that renders content conditionally.","params":[{"type":{"names":["function"]},"description":"

A function to reactively re-run. Whether the result is truthy or falsy determines whether contentFunc or elseFunc is shown. An empty array is considered falsy.

","name":"conditionFunc"},{"type":{"names":["function"]},"description":"

A Function that returns renderable content.

","name":"contentFunc"},{"type":{"names":["function"]},"optional":true,"description":"

Optional. A Function that returns renderable content. If no elseFunc is supplied, no content is shown in the "else" case.

","name":"elseFunc"}],"name":"If","longname":"Blaze.If","kind":"function","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"Unless":{"summary":"An inverted [`Blaze.If`](#blaze_if).","params":[{"type":{"names":["function"]},"description":"

A function to reactively re-run. If the result is falsy, contentFunc is shown, otherwise elseFunc is shown. An empty array is considered falsy.

","name":"conditionFunc"},{"type":{"names":["function"]},"description":"

A Function that returns renderable content.

","name":"contentFunc"},{"type":{"names":["function"]},"optional":true,"description":"

Optional. A Function that returns renderable content. If no elseFunc is supplied, no content is shown in the "else" case.

","name":"elseFunc"}],"name":"Unless","longname":"Blaze.Unless","kind":"function","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"Each":{"summary":"Constructs a View that renders `contentFunc` for each item in a sequence.","params":[{"type":{"names":["function"]},"description":"

A function to reactively re-run. The function may return a Cursor, an array, null, or undefined.

","name":"argFunc"},{"type":{"names":["function"]},"description":"

A Function that returns renderable content.

","name":"contentFunc"},{"type":{"names":["function"]},"optional":true,"description":"

Optional. A Function that returns renderable content to display in the case when there are no items to display.

","name":"elseFunc"}],"name":"Each","longname":"Blaze.Each","kind":"function","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"isTemplate":{"summary":"Returns true if `value` is a template object like `Template.myTemplate`.","params":[{"type":{"names":["Any"]},"description":"

The value to test.

","name":"value"}],"name":"isTemplate","longname":"Blaze.isTemplate","kind":"function","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"TemplateInstance#$":{"summary":"Find all elements matching `selector` in this template instance, and return them as a JQuery object.","params":[{"type":{"names":["String"]},"description":"

The CSS selector to match, scoped to the template contents.

","name":"selector"}],"name":"$","longname":"Blaze.TemplateInstance#$","kind":"function","memberof":"Blaze.TemplateInstance","scope":"instance","options":[],"locus":"Client"},"TemplateInstance#findAll":{"summary":"Find all elements matching `selector` in this template instance.","params":[{"type":{"names":["String"]},"description":"

The CSS selector to match, scoped to the template contents.

","name":"selector"}],"name":"findAll","longname":"Blaze.TemplateInstance#findAll","kind":"function","memberof":"Blaze.TemplateInstance","scope":"instance","options":[],"locus":"Client"},"TemplateInstance#find":{"summary":"Find one element matching `selector` in this template instance.","params":[{"type":{"names":["String"]},"description":"

The CSS selector to match, scoped to the template contents.

","name":"selector"}],"name":"find","longname":"Blaze.TemplateInstance#find","kind":"function","memberof":"Blaze.TemplateInstance","scope":"instance","options":[],"locus":"Client"},"TemplateInstance#autorun":{"summary":"A version of [Tracker.autorun](#tracker_autorun) that is stopped when the template is destroyed.","params":[{"type":{"names":["function"]},"description":"

The function to run. It receives one argument: a Tracker.Computation object.

","name":"runFunc"}],"name":"autorun","longname":"Blaze.TemplateInstance#autorun","kind":"function","memberof":"Blaze.TemplateInstance","scope":"instance","options":[],"locus":"Client"},"render":{"summary":"Renders a template or View to DOM nodes and inserts it into the DOM, returning a rendered [View](#blaze_view) which can be passed to [`Blaze.remove`](#blaze_remove).","params":[{"type":{"names":["Template","Blaze.View"]},"description":"

The template (e.g. Template.myTemplate) or View object to render. If a template, a View object is constructed. If a View, it must be an unrendered View, which becomes a rendered View and is returned.

","name":"templateOrView"},{"type":{"names":["DOMNode"]},"description":"

The node that will be the parent of the rendered template. It must be an Element node.

","name":"parentNode"},{"type":{"names":["DOMNode"]},"optional":true,"description":"

Optional. If provided, must be a child of parentNode; the template will be inserted before this node. If not provided, the template will be inserted as the last child of parentNode.

","name":"nextNode"},{"type":{"names":["Blaze.View"]},"optional":true,"description":"

Optional. If provided, it will be set as the rendered View's parentView.

","name":"parentView"}],"name":"render","longname":"Blaze.render","kind":"function","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"renderWithData":{"summary":"Renders a template or View to DOM nodes with a data context. Otherwise identical to `Blaze.render`.","params":[{"type":{"names":["Template","Blaze.View"]},"description":"

The template (e.g. Template.myTemplate) or View object to render.

","name":"templateOrView"},{"type":{"names":["Object","function"]},"description":"

The data context to use, or a function returning a data context. If a function is provided, it will be reactively re-run.

","name":"data"},{"type":{"names":["DOMNode"]},"description":"

The node that will be the parent of the rendered template. It must be an Element node.

","name":"parentNode"},{"type":{"names":["DOMNode"]},"optional":true,"description":"

Optional. If provided, must be a child of parentNode; the template will be inserted before this node. If not provided, the template will be inserted as the last child of parentNode.

","name":"nextNode"},{"type":{"names":["Blaze.View"]},"optional":true,"description":"

Optional. If provided, it will be set as the rendered View's parentView.

","name":"parentView"}],"name":"renderWithData","longname":"Blaze.renderWithData","kind":"function","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"remove":{"summary":"Removes a rendered View from the DOM, stopping all reactive updates and event listeners on it.","params":[{"type":{"names":["Blaze.View"]},"description":"

The return value from Blaze.render or Blaze.renderWithData.

","name":"renderedView"}],"name":"remove","longname":"Blaze.remove","kind":"function","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"toHTML":{"summary":"Renders a template or View to a string of HTML.","params":[{"type":{"names":["Template","Blaze.View"]},"description":"

The template (e.g. Template.myTemplate) or View object from which to generate HTML.

","name":"templateOrView"}],"name":"toHTML","longname":"Blaze.toHTML","kind":"function","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"toHTMLWithData":{"summary":"Renders a template or View to HTML with a data context. Otherwise identical to `Blaze.toHTML`.","params":[{"type":{"names":["Template","Blaze.View"]},"description":"

The template (e.g. Template.myTemplate) or View object from which to generate HTML.

","name":"templateOrView"},{"type":{"names":["Object","function"]},"description":"

The data context to use, or a function returning a data context.

","name":"data"}],"name":"toHTMLWithData","longname":"Blaze.toHTMLWithData","kind":"function","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"getData":{"summary":"Returns the current data context, or the data context that was used when rendering a particular DOM element or View from a Meteor template.","params":[{"type":{"names":["DOMElement","Blaze.View"]},"optional":true,"description":"

Optional. An element that was rendered by a Meteor, or a View.

","name":"elementOrView"}],"name":"getData","longname":"Blaze.getData","kind":"function","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"getView":{"summary":"Gets either the current View, or the View enclosing the given DOM element.","params":[{"type":{"names":["DOMElement"]},"optional":true,"description":"

Optional. If specified, the View enclosing element is returned.

","name":"element"}],"name":"getView","longname":"Blaze.getView","kind":"function","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"Template":{"kind":"class","summary":"Constructor for a Template, which is used to construct Views with particular name and content.","params":[{"type":{"names":["String"]},"optional":true,"description":"

Optional. A name for Views constructed by this Template. See view.name.

","name":"viewName"},{"type":{"names":["function"]},"description":"

A function that returns renderable content. This function is used as the renderFunction for Views constructed by this Template.

","name":"renderFunction"}],"name":"Template","longname":"Blaze.Template","memberof":"Blaze","scope":"static","options":[],"locus":"Client"},"TemplateInstance":{"kind":"class","summary":"The class for template instances","params":[{"type":{"names":["Blaze.View"]},"name":"view"}],"name":"TemplateInstance","longname":"Blaze.TemplateInstance","memberof":"Blaze","scope":"static","options":[],"instancename":"template"},"View":{"kind":"class","summary":"Constructor for a View, which represents a reactive region of DOM.","params":[{"type":{"names":["String"]},"optional":true,"description":"

Optional. A name for this type of View. See view.name.

","name":"name"},{"type":{"names":["function"]},"description":"

A function that returns renderable content. In this function, this is bound to the View.

","name":"renderFunction"}],"name":"View","longname":"Blaze.View","memberof":"Blaze","scope":"static","options":[],"locus":"Client"}},"MethodInvocation#isSimulation":{"summary":"Access inside a method invocation. Boolean value, true if this invocation is a stub.","name":"isSimulation","memberof":"MethodInvocation","scope":"instance","longname":"MethodInvocation#isSimulation","kind":"member","locus":"Anywhere"},"MethodInvocation#userId":{"summary":"The id of the user that made this method call, or `null` if no user was logged in.","name":"userId","memberof":"MethodInvocation","scope":"instance","longname":"MethodInvocation#userId","kind":"member","locus":"Anywhere"},"MethodInvocation#connection":{"summary":"Access inside a method invocation. The [connection](#meteor_onconnection) that this method was received on. `null` if the method is not associated with a connection, eg. a server initiated method call.","name":"connection","memberof":"MethodInvocation","scope":"instance","longname":"MethodInvocation#connection","kind":"member","locus":"Server"},"Subscription#connection":{"summary":"Access inside the publish function. The incoming [connection](#meteor_onconnection) for this subscription.","name":"connection","memberof":"Subscription","scope":"instance","longname":"Subscription#connection","kind":"member","locus":"Server"},"Subscription#userId":{"summary":"Access inside the publish function. The id of the logged-in user, or `null` if no user is logged in.","memberof":"Subscription","name":"userId","scope":"instance","longname":"Subscription#userId","kind":"member","locus":"Server"},"Template":{"body":{"summary":"The [template object](#templates_api) representing your `` tag.","name":"body","longname":"Template.body","kind":"member","memberof":"Template","scope":"static","locus":"Client"},"instance":{"kind":"function","name":"instance","memberof":"Template","summary":"The [template instance](#template_inst) corresponding to the current template helper, event handler, callback, or autorun. If there isn't one, `null`.","scope":"static","longname":"Template.instance","options":[],"params":[],"locus":"Client"},"currentData":{"summary":"Returns the data context of the current helper, or the data context of the template that declares the current event handler or callback. Establishes a reactive dependency on the result.","kind":"function","name":"currentData","longname":"Template.currentData","memberof":"Template","scope":"static","options":[],"params":[],"locus":"Client"},"parentData":{"summary":"Accesses other data contexts that enclose the current data context.","kind":"function","params":[{"type":{"names":["Integer"]},"description":"

The number of levels beyond the current data context to look.

","name":"numLevels"}],"name":"parentData","longname":"Template.parentData","memberof":"Template","scope":"static","options":[],"locus":"Client"},"registerHelper":{"summary":"Defines a [helper function](#template_helpers) which can be used from all templates.","kind":"function","params":[{"type":{"names":["String"]},"description":"

The name of the helper function you are defining.

","name":"name"},{"type":{"names":["function"]},"description":"

The helper function itself.

","name":"function"}],"name":"registerHelper","longname":"Template.registerHelper","memberof":"Template","scope":"static","options":[],"locus":"Client"},"dynamic":{"memberof":"Template","kind":"function","name":"dynamic","summary":"Choose a template to include dynamically, by name.","params":[{"type":{"names":["String"]},"description":"

The name of the template to include.

","name":"template"},{"type":{"names":["Object"]},"optional":true,"description":"

Optional. The data context in which to include the template.

","name":"data"}],"scope":"static","longname":"Template.dynamic","options":[],"istemplate":"true","locus":"Templates"},"summary":"The class for defining templates","kind":"class","name":"Template","longname":"Template","scope":"global","options":[],"params":[],"instancename":"Template.myTemplate"},"Tracker":{"active":{"summary":"True if there is a current computation, meaning that dependencies on reactive data sources will be tracked and potentially cause the current computation to be rerun.","name":"active","longname":"Tracker.active","kind":"member","memberof":"Tracker","scope":"static","locus":"Client"},"currentComputation":{"summary":"The current computation, or `null` if there isn't one. The current computation is the [`Tracker.Computation`](#tracker_computation) object created by the innermost active call to `Tracker.autorun`, and it's the computation that gains dependencies when reactive data sources are accessed.","name":"currentComputation","longname":"Tracker.currentComputation","kind":"member","memberof":"Tracker","scope":"static","locus":"Client"},"Computation#stopped":{"summary":"True if this computation has been stopped.","memberof":"Tracker.Computation","scope":"instance","name":"stopped","longname":"Tracker.Computation#stopped","kind":"member","locus":"Client"},"Computation#invalidated":{"summary":"True if this computation has been invalidated (and not yet rerun), or if it has been stopped.","memberof":"Tracker.Computation","scope":"instance","name":"invalidated","longname":"Tracker.Computation#invalidated","kind":"member","locus":"Client"},"Computation#firstRun":{"summary":"True during the initial run of the computation at the time `Tracker.autorun` is called, and false on subsequent reruns and at other times.","memberof":"Tracker.Computation","scope":"instance","name":"firstRun","longname":"Tracker.Computation#firstRun","kind":"member","locus":"Client"},"Computation":{"summary":"A Computation object represents code that is repeatedly rerun\nin response to\nreactive data changes. Computations don't have return values; they just\nperform actions, such as rerendering a template on the screen. Computations\nare created using Tracker.autorun. Use stop to prevent further rerunning of a\ncomputation.","name":"Computation","longname":"Tracker.Computation","kind":"function","memberof":"Tracker","scope":"static","options":[],"params":[],"instancename":"computation"},"Computation#onInvalidate":{"summary":"Registers `callback` to run when this computation is next invalidated, or runs it immediately if the computation is already invalidated. The callback is run exactly once and not upon future invalidations unless `onInvalidate` is called again after the computation becomes valid again.","params":[{"type":{"names":["function"]},"description":"

Function to be called on invalidation. Receives one argument, the computation that was invalidated.

","name":"callback"}],"name":"onInvalidate","longname":"Tracker.Computation#onInvalidate","kind":"function","memberof":"Tracker.Computation","scope":"instance","options":[],"locus":"Client"},"Computation#invalidate":{"summary":"Invalidates this computation so that it will be rerun.","name":"invalidate","longname":"Tracker.Computation#invalidate","kind":"function","memberof":"Tracker.Computation","scope":"instance","options":[],"params":[],"locus":"Client"},"Computation#stop":{"summary":"Prevents this computation from rerunning.","name":"stop","longname":"Tracker.Computation#stop","kind":"function","memberof":"Tracker.Computation","scope":"instance","options":[],"params":[],"locus":"Client"},"Dependency#depend":{"summary":"Declares that the current computation (or `fromComputation` if given) depends on `dependency`. The computation will be invalidated the next time `dependency` changes.\n\nIf there is no current computation and `depend()` is called with no arguments, it does nothing and returns false.\n\nReturns true if the computation is a new dependent of `dependency` rather than an existing one.","params":[{"type":{"names":["Tracker.Computation"]},"optional":true,"description":"

An optional computation declared to depend on dependency instead of the current computation.

","name":"fromComputation"}],"name":"depend","longname":"Tracker.Dependency#depend","kind":"function","memberof":"Tracker.Dependency","scope":"instance","options":[],"locus":"Client"},"Dependency#changed":{"summary":"Invalidate all dependent computations immediately and remove them as dependents.","name":"changed","longname":"Tracker.Dependency#changed","kind":"function","memberof":"Tracker.Dependency","scope":"instance","options":[],"params":[],"locus":"Client"},"Dependency#hasDependents":{"summary":"True if this Dependency has one or more dependent Computations, which would be invalidated if this Dependency were to change.","name":"hasDependents","longname":"Tracker.Dependency#hasDependents","kind":"function","memberof":"Tracker.Dependency","scope":"instance","options":[],"params":[],"locus":"Client"},"flush":{"summary":"Process all reactive updates immediately and ensure that all invalidated computations are rerun.","name":"flush","longname":"Tracker.flush","kind":"function","memberof":"Tracker","scope":"static","options":[],"params":[],"locus":"Client"},"autorun":{"summary":"Run a function now and rerun it later whenever its dependencies change. Returns a Computation object that can be used to stop or observe the rerunning.","params":[{"type":{"names":["function"]},"description":"

The function to run. It receives one argument: the Computation object that will be returned.

","name":"runFunc"}],"name":"autorun","longname":"Tracker.autorun","kind":"function","memberof":"Tracker","scope":"static","options":[],"locus":"Client"},"nonreactive":{"summary":"Run a function without tracking dependencies.","params":[{"type":{"names":["function"]},"description":"

A function to call immediately.

","name":"func"}],"name":"nonreactive","longname":"Tracker.nonreactive","kind":"function","memberof":"Tracker","scope":"static","options":[],"locus":"Client"},"onInvalidate":{"summary":"Registers a new [`onInvalidate`](#computation_oninvalidate) callback on the current computation (which must exist), to be called immediately when the current computation is invalidated or stopped.","params":[{"type":{"names":["function"]},"description":"

A callback function that will be invoked as func(c), where c is the computation on which the callback is registered.

","name":"callback"}],"name":"onInvalidate","longname":"Tracker.onInvalidate","kind":"function","memberof":"Tracker","scope":"static","options":[],"locus":"Client"},"afterFlush":{"summary":"Schedules a function to be called during the next flush, or later in the current flush if one is in progress, after all invalidated computations have been rerun. The function will be run once and not on subsequent flushes unless `afterFlush` is called again.","params":[{"type":{"names":["function"]},"description":"

A function to call at flush time.

","name":"callback"}],"name":"afterFlush","longname":"Tracker.afterFlush","kind":"function","memberof":"Tracker","scope":"static","options":[],"locus":"Client"},"Dependency":{"summary":"A Dependency represents an atomic unit of reactive data that a\ncomputation might depend on. Reactive data sources such as Session or\nMinimongo internally create different Dependency objects for different\npieces of data, each of which may be depended on by multiple computations.\nWhen the data changes, the computations are invalidated.","kind":"class","name":"Dependency","longname":"Tracker.Dependency","memberof":"Tracker","scope":"static","options":[],"params":[],"instancename":"dependency"}},"CompileStep#inputSize":{"summary":"The total number of bytes in the input file.","memberof":"CompileStep","scope":"instance","type":{"names":["Integer"]},"name":"inputSize","longname":"CompileStep#inputSize","kind":"member"},"CompileStep#inputPath":{"summary":"The filename and relative path of the input file.\nPlease don't use this filename to read the file from disk, instead\nuse [compileStep.read](CompileStep-read).","type":{"names":["String"]},"scope":"instance","memberof":"CompileStep","name":"inputPath","longname":"CompileStep#inputPath","kind":"member"},"CompileStep#fullInputPath":{"summary":"The filename and absolute path of the input file.\nPlease don't use this filename to read the file from disk, instead\nuse [compileStep.read](CompileStep-read).","type":{"names":["String"]},"scope":"instance","memberof":"CompileStep","name":"fullInputPath","longname":"CompileStep#fullInputPath","kind":"member"},"CompileStep#pathForSourceMap":{"summary":"If you are generating a sourcemap for the compiled file, use\nthis path for the original file in the sourcemap.","type":{"names":["String"]},"memberof":"CompileStep","scope":"instance","name":"pathForSourceMap","longname":"CompileStep#pathForSourceMap","kind":"member"},"CompileStep#packageName":{"summary":"The name of the package in which the file being built exists.","type":{"names":["String"]},"memberof":"CompileStep","scope":"instance","name":"packageName","longname":"CompileStep#packageName","kind":"member"},"CompileStep#rootOutputPath":{"summary":"On web targets, this will be the root URL prepended\nto the paths you pick for your output files. For example,\nit could be \"/packages/my-package\".","type":{"names":["String"]},"memberof":"CompileStep","scope":"instance","name":"rootOutputPath","longname":"CompileStep#rootOutputPath","kind":"member"},"CompileStep#arch":{"summary":"The architecture for which we are building. Can be \"os\",\n\"web.browser\", or \"web.cordova\".","type":{"names":["String"]},"memberof":"CompileStep","scope":"instance","name":"arch","longname":"CompileStep#arch","kind":"member"},"CompileStep#fileOptions":{"summary":"Any options passed to \"api.addFiles\".","type":{"names":["Object"]},"memberof":"CompileStep","scope":"instance","name":"fileOptions","longname":"CompileStep#fileOptions","kind":"member"},"CompileStep#declaredExports":{"summary":"The list of exports that the current package has defined.\nCan be used to treat those symbols differently during compilation.","type":{"names":["Object"]},"memberof":"CompileStep","scope":"instance","name":"declaredExports","longname":"CompileStep#declaredExports","kind":"member"},"Template#helpers":{"summary":"Specify template helpers available to this template.","params":[{"type":{"names":["Object"]},"description":"

Dictionary of helper functions by name.

","name":"helpers"}],"name":"helpers","longname":"Template#helpers","kind":"function","memberof":"Template","scope":"instance","options":[],"locus":"Client"},"Template#events":{"summary":"Specify event handlers for this template.","params":[{"type":{"names":["EventMap"]},"description":"

Event handlers to associate with this template.

","name":"eventMap"}],"name":"events","longname":"Template#events","kind":"function","memberof":"Template","scope":"instance","options":[],"locus":"Client"},"check":{"summary":"Check that a value matches a [pattern](#matchpatterns).\nIf the value does not match the pattern, throw a `Match.Error`.\n\nParticularly useful to assert that arguments to a function have the right\ntypes and structure.","params":[{"type":{"names":["Any"]},"description":"

The value to check

","name":"value"},{"type":{"names":["MatchPattern"]},"description":"

The pattern to match\nvalue against

","name":"pattern"}],"name":"check","longname":"check","kind":"function","scope":"global","options":[],"locus":"Anywhere"},"Match":{"test":{"summary":"Returns true if the value matches the pattern.","params":[{"type":{"names":["Any"]},"description":"

The value to check

","name":"value"},{"type":{"names":["MatchPattern"]},"description":"

The pattern to match value against

","name":"pattern"}],"name":"test","longname":"Match.test","kind":"function","memberof":"Match","scope":"static","options":[],"locus":"Anywhere"}},"MethodInvocation":{"summary":"The state for a single invocation of a method, referenced by this\ninside a method definition.","params":[{"type":{"names":["Object"]},"name":"options"}],"name":"MethodInvocation","longname":"MethodInvocation","kind":"function","scope":"global","options":[],"instancename":"this"},"MethodInvocation#unblock":{"summary":"Call inside a method invocation. Allow subsequent method from this client to begin running in a new fiber.","memberof":"MethodInvocation","scope":"instance","name":"unblock","longname":"MethodInvocation#unblock","kind":"function","options":[],"params":[],"locus":"Server"},"MethodInvocation#setUserId":{"summary":"Set the logged in user.","memberof":"MethodInvocation","scope":"instance","params":[{"type":{"names":["String","null"]},"description":"

The value that should be returned by userId on this connection.

","name":"userId"}],"name":"setUserId","longname":"MethodInvocation#setUserId","kind":"function","options":[],"locus":"Server"},"DDP":{"connect":{"summary":"Connect to the server of a different Meteor application to subscribe to its document sets and invoke its remote methods.","params":[{"type":{"names":["String"]},"description":"

The URL of another Meteor application.

","name":"url"}],"name":"connect","longname":"DDP.connect","kind":"function","memberof":"DDP","scope":"static","options":[],"locus":"Anywhere"}},"Subscription#error":{"summary":"Call inside the publish function. Stops this client's subscription, triggering a call on the client to the `onError` callback passed to [`Meteor.subscribe`](#meteor_subscribe), if any. If `error` is not a [`Meteor.Error`](#meteor_error), it will be [sanitized](#meteor_error).","params":[{"type":{"names":["Error"]},"description":"

The error to pass to the client.

","name":"error"}],"scope":"instance","memberof":"Subscription","name":"error","longname":"Subscription#error","kind":"function","options":[],"locus":"Server"},"Subscription#stop":{"summary":"Call inside the publish function. Stops this client's subscription; the `onError` callback is *not* invoked on the client.","scope":"instance","memberof":"Subscription","name":"stop","longname":"Subscription#stop","kind":"function","options":[],"params":[],"locus":"Server"},"Subscription#onStop":{"summary":"Call inside the publish function. Registers a callback function to run when the subscription is stopped.","memberof":"Subscription","scope":"instance","params":[{"type":{"names":["function"]},"description":"

The callback function

","name":"func"}],"name":"onStop","longname":"Subscription#onStop","kind":"function","options":[],"locus":"Server"},"Subscription#added":{"summary":"Call inside the publish function. Informs the subscriber that a document has been added to the record set.","memberof":"Subscription","scope":"instance","params":[{"type":{"names":["String"]},"description":"

The name of the collection that contains the new document.

","name":"collection"},{"type":{"names":["String"]},"description":"

The new document's ID.

","name":"id"},{"type":{"names":["Object"]},"description":"

The fields in the new document. If _id is present it is ignored.

","name":"fields"}],"name":"added","longname":"Subscription#added","kind":"function","options":[],"locus":"Server"},"Subscription#changed":{"summary":"Call inside the publish function. Informs the subscriber that a document in the record set has been modified.","memberof":"Subscription","scope":"instance","params":[{"type":{"names":["String"]},"description":"

The name of the collection that contains the changed document.

","name":"collection"},{"type":{"names":["String"]},"description":"

The changed document's ID.

","name":"id"},{"type":{"names":["Object"]},"description":"

The fields in the document that have changed, together with their new values. If a field is not present in fields it was left unchanged; if it is present in fields and has a value of undefined it was removed from the document. If _id is present it is ignored.

","name":"fields"}],"name":"changed","longname":"Subscription#changed","kind":"function","options":[],"locus":"Server"},"Subscription#removed":{"summary":"Call inside the publish function. Informs the subscriber that a document has been removed from the record set.","memberof":"Subscription","scope":"instance","params":[{"type":{"names":["String"]},"description":"

The name of the collection that the document has been removed from.

","name":"collection"},{"type":{"names":["String"]},"description":"

The ID of the document that has been removed.

","name":"id"}],"name":"removed","longname":"Subscription#removed","kind":"function","options":[],"locus":"Server"},"Subscription#ready":{"summary":"Call inside the publish function. Informs the subscriber that an initial, complete snapshot of the record set has been sent. This will trigger a call on the client to the `onReady` callback passed to [`Meteor.subscribe`](#meteor_subscribe), if any.","memberof":"Subscription","scope":"instance","name":"ready","longname":"Subscription#ready","kind":"function","options":[],"params":[],"locus":"Server"},"Email":{"send":{"summary":"Send an email. Throws an `Error` on failure to contact mail server\nor if mail server returns an error. All fields should match\n[RFC5322](http://tools.ietf.org/html/rfc5322) specification.","params":[{"type":{"names":["Object"]},"name":"options"}],"name":"send","longname":"Email.send","kind":"function","memberof":"Email","scope":"static","options":[{"type":{"names":["String"]},"description":"

"From:" address (required)

","name":"from"},{"type":{"names":["String","Array."]},"description":"

"To:", "Cc:", "Bcc:", and "Reply-To:" addresses

","name":"to, cc, bcc, replyTo"},{"type":{"names":["String"]},"optional":true,"description":"

"Subject:" line

","name":"subject"},{"type":{"names":["String"]},"optional":true,"description":"

Mail body (in plain text or HTML)

","name":"text, html"},{"type":{"names":["Object"]},"optional":true,"description":"

Dictionary of custom headers

","name":"headers"}],"locus":"Server"}},"HTTP":{"call":{"summary":"Perform an outbound HTTP request.","params":[{"type":{"names":["String"]},"description":"

The HTTP method to use, such as "GET", "POST", or "HEAD".

","name":"method"},{"type":{"names":["String"]},"description":"

The URL to retrieve.

","name":"url"},{"type":{"names":["Object"]},"optional":true,"name":"options"},{"type":{"names":["function"]},"optional":true,"description":"

Optional callback. If passed, the method runs asynchronously, instead of synchronously, and calls asyncCallback. On the client, this callback is required.

","name":"asyncCallback"}],"name":"call","longname":"HTTP.call","kind":"function","memberof":"HTTP","scope":"static","options":[{"type":{"names":["String"]},"description":"

String to use as the HTTP request body.

","name":"content"},{"type":{"names":["Object"]},"description":"

JSON-able object to stringify and use as the HTTP request body. Overwrites content.

","name":"data"},{"type":{"names":["String"]},"description":"

Query string to go in the URL. Overwrites any query string in url.

","name":"query"},{"type":{"names":["Object"]},"description":"

Dictionary of request parameters to be encoded and placed in the URL (for GETs) or request body (for POSTs). If content or data is specified, params will always be placed in the URL.

","name":"params"},{"type":{"names":["String"]},"description":"

HTTP basic authentication string of the form "username:password"

","name":"auth"},{"type":{"names":["Object"]},"description":"

Dictionary of strings, headers to add to the HTTP request.

","name":"headers"},{"type":{"names":["Number"]},"description":"

Maximum time in milliseconds to wait for the request before failing. There is no timeout by default.

","name":"timeout"},{"type":{"names":["Boolean"]},"description":"

If true, transparently follow HTTP redirects. Cannot be set to false on the client. Default true.

","name":"followRedirects"}],"locus":"Anywhere"},"get":{"summary":"Send an HTTP `GET` request. Equivalent to calling [`HTTP.call`](#http_call) with \"GET\" as the first argument.","params":[{"type":{"names":["String"]},"description":"

The URL to which the request should be sent.

","name":"url"},{"type":{"names":["Object"]},"optional":true,"description":"

Options passed on to HTTP.call.

","name":"callOptions"},{"type":{"names":["function"]},"optional":true,"description":"

Callback that is called when the request is completed. Required on the client.

","name":"asyncCallback"}],"name":"get","longname":"HTTP.get","kind":"function","memberof":"HTTP","scope":"static","options":[],"locus":"Anywhere"},"post":{"summary":"Send an HTTP `POST` request. Equivalent to calling [`HTTP.call`](#http_call) with \"POST\" as the first argument.","params":[{"type":{"names":["String"]},"description":"

The URL to which the request should be sent.

","name":"url"},{"type":{"names":["Object"]},"optional":true,"description":"

Options passed on to HTTP.call.

","name":"callOptions"},{"type":{"names":["function"]},"optional":true,"description":"

Callback that is called when the request is completed. Required on the client.

","name":"asyncCallback"}],"name":"post","longname":"HTTP.post","kind":"function","memberof":"HTTP","scope":"static","options":[],"locus":"Anywhere"},"put":{"summary":"Send an HTTP `PUT` request. Equivalent to calling [`HTTP.call`](#http_call) with \"PUT\" as the first argument.","params":[{"type":{"names":["String"]},"description":"

The URL to which the request should be sent.

","name":"url"},{"type":{"names":["Object"]},"optional":true,"description":"

Options passed on to HTTP.call.

","name":"callOptions"},{"type":{"names":["function"]},"optional":true,"description":"

Callback that is called when the request is completed. Required on the client.

","name":"asyncCallback"}],"name":"put","longname":"HTTP.put","kind":"function","memberof":"HTTP","scope":"static","options":[],"locus":"Anywhere"},"del":{"summary":"Send an HTTP `DELETE` request. Equivalent to calling [`HTTP.call`](#http_call) with \"DELETE\" as the first argument. (Named `del` to avoid conflic with the Javascript keyword `delete`)","params":[{"type":{"names":["String"]},"description":"

The URL to which the request should be sent.

","name":"url"},{"type":{"names":["Object"]},"optional":true,"description":"

Options passed on to HTTP.call.

","name":"callOptions"},{"type":{"names":["function"]},"optional":true,"description":"

Callback that is called when the request is completed. Required on the client.

","name":"asyncCallback"}],"name":"del","longname":"HTTP.del","kind":"function","memberof":"HTTP","scope":"static","options":[],"locus":"Anywhere"}},"ReactiveVar#get":{"summary":"Returns the current value of the ReactiveVar, establishing a reactive dependency.","name":"get","longname":"ReactiveVar#get","kind":"function","memberof":"ReactiveVar","scope":"instance","options":[],"params":[],"locus":"Client"},"ReactiveVar#set":{"summary":"Sets the current value of the ReactiveVar, invalidating the Computations that called `get` if `newValue` is different from the old value.","params":[{"type":{"names":["Any"]},"name":"newValue"}],"name":"set","longname":"ReactiveVar#set","kind":"function","memberof":"ReactiveVar","scope":"instance","options":[],"locus":"Client"},"Session":{"set":{"memberof":"Session","kind":"function","name":"set","summary":"Set a variable in the session. Notify any listeners that the value has changed (eg: redraw templates, and rerun any [`Tracker.autorun`](#tracker_autorun) computations, that called [`Session.get`](#session_get) on this `key`.)","params":[{"type":{"names":["String"]},"description":"

The key to set, eg, selectedItem

","name":"key"},{"type":{"names":["EJSONable","undefined"]},"description":"

The new value for key

","name":"value"}],"scope":"static","longname":"Session.set","options":[],"locus":"Client"},"setDefault":{"memberof":"Session","kind":"function","name":"setDefault","summary":"Set a variable in the session if it hasn't been set before. Otherwise works exactly the same as [`Session.set`](#session_set).","params":[{"type":{"names":["String"]},"description":"

The key to set, eg, selectedItem

","name":"key"},{"type":{"names":["EJSONable","undefined"]},"description":"

The new value for key

","name":"value"}],"scope":"static","longname":"Session.setDefault","options":[],"locus":"Client"},"get":{"memberof":"Session","kind":"function","name":"get","summary":"Get the value of a session variable. If inside a [reactive computation](#reactivity), invalidate the computation the next time the value of the variable is changed by [`Session.set`](#session_set). This returns a clone of the session value, so if it's an object or an array, mutating the returned value has no effect on the value stored in the session.","params":[{"type":{"names":["String"]},"description":"

The name of the session variable to return

","name":"key"}],"scope":"static","longname":"Session.get","options":[],"locus":"Client"},"equals":{"memberof":"Session","kind":"function","name":"equals","summary":"Test if a session variable is equal to a value. If inside a [reactive computation](#reactivity), invalidate the computation the next time the variable changes to or from the value.","params":[{"type":{"names":["String"]},"description":"

The name of the session variable to test

","name":"key"},{"type":{"names":["String","Number","Boolean","null","undefined"]},"description":"

The value to test against

","name":"value"}],"scope":"static","longname":"Session.equals","options":[],"locus":"Client"}},"CompileStep#read":{"summary":"Read from the input file. If `n` is specified, returns the\nnext `n` bytes of the file as a Buffer. XXX not sure if this actually\nreturns a String sometimes...","params":[{"type":{"names":["Integer"]},"optional":true,"description":"

The number of bytes to return.

","name":"n"}],"scope":"instance","memberof":"CompileStep","name":"read","longname":"CompileStep#read","kind":"function","options":[]},"CompileStep#addHtml":{"summary":"Works in web targets only. Add markup to the `head` or `body`\nsection of the document.","params":[{"type":{"names":["Object"]},"name":"options"}],"memberof":"CompileStep","scope":"instance","name":"addHtml","longname":"CompileStep#addHtml","kind":"function","options":[{"type":{"names":["String"]},"description":"

Which section of the document should\nbe appended to. Can only be "head" or "body".

","name":"section"},{"type":{"names":["String"]},"description":"

The content to append.

","name":"data"}]},"CompileStep#addStylesheet":{"summary":"Web targets only. Add a stylesheet to the document.","params":[{"type":{"names":["Object"]},"name":"options"},{"type":{"names":["String"]},"description":"

The requested path for the added CSS, may not be\nsatisfied if there are path conflicts.

","name":"path"},{"type":{"names":["String"]},"description":"

The content of the stylesheet that should be\nadded.

","name":"data"},{"type":{"names":["String"]},"description":"

A stringified JSON sourcemap, in case the\nstylesheet was generated from a different file.

","name":"sourceMap"}],"memberof":"CompileStep","scope":"instance","name":"addStylesheet","longname":"CompileStep#addStylesheet","kind":"function","options":[]},"CompileStep#addJavaScript":{"summary":"Add JavaScript code. The code added will only see the\nnamespaces imported by this package as runtime dependencies using\n['api.use'](#PackageAPI-use). If the file being compiled was added\nwith the bare flag, the resulting JavaScript won't be wrapped in a\nclosure.","params":[{"type":{"names":["Object"]},"name":"options"}],"memberof":"CompileStep","scope":"instance","name":"addJavaScript","longname":"CompileStep#addJavaScript","kind":"function","options":[{"type":{"names":["String"]},"description":"

The path at which the JavaScript file\nshould be inserted, may not be honored in case of path conflicts.

","name":"path"},{"type":{"names":["String"]},"description":"

The code to be added.

","name":"data"},{"type":{"names":["String"]},"description":"

The path that will be used in\nany error messages generated by this file, e.g. foo.js:4:1: error.

","name":"sourcePath"}]},"CompileStep#addAsset":{"summary":"Add a file to serve as-is to the browser or to include on\nthe browser, depending on the target. On the web, it will be served\nat the exact path requested. For server targets, it can be retrieved\nusing `Assets.getText` or `Assets.getBinary`.","params":[{"type":{"names":["Object"]},"name":"options"},{"type":{"names":["String"]},"description":"

The path at which to serve the asset.

","name":"path"},{"type":{"names":["Buffer","String"]},"description":"

The data that should be placed in\nthe file.

","name":"data"}],"memberof":"CompileStep","scope":"instance","name":"addAsset","longname":"CompileStep#addAsset","kind":"function","options":[]},"CompileStep#error":{"summary":"Display a build error.","params":[{"type":{"names":["Object"]},"name":"options"},{"type":{"names":["String"]},"description":"

The error message to display.

","name":"message"},{"type":{"names":["String"]},"optional":true,"description":"

The path to display in the error message.

","name":"sourcePath"},{"type":{"names":["Integer"]},"description":"

The line number to display in the error message.

","name":"line"},{"type":{"names":["String"]},"description":"

The function name to display in the error message.

","name":"func"}],"memberof":"CompileStep","scope":"instance","name":"error","longname":"CompileStep#error","kind":"function","options":[]},"PackageAPI#use":{"memberof":"PackageAPI","scope":"instance","summary":"Depend on package `packagename`.","params":[{"type":{"names":["String","Array."]},"description":"

Packages being depended on.\nPackage names may be suffixed with an @version tag.

\n

In general, you must specify a package's version (e.g.,\n'accounts@1.0.0' to use version 1.0.0 or a higher\ncompatible version (ex: 1.0.1, 1.5.0, etc.) of the\naccounts package). If you are sourcing core\npackages from a Meteor release with versionsFrom, you may leave\noff version names for core packages. You may also specify constraints,\nsuch as my:forms@=1.0.0 (this package demands my:forms at 1.0.0 exactly),\nor my:forms@1.0.0 || =2.0.1 (my:forms at 1.x.y, or exactly 2.0.1).

","name":"packageNames"},{"type":{"names":["String"]},"optional":true,"description":"

If you only use the package on the\nserver (or the client), you can pass in the second argument (e.g.,\n'server' or 'client') to specify what architecture the package is\nused with.

","name":"architecture"},{"type":{"names":["Object"]},"optional":true,"name":"options"}],"name":"use","longname":"PackageAPI#use","kind":"function","options":[{"type":{"names":["Boolean"]},"description":"

Establish a weak dependency on a\npackage. If package A has a weak dependency on package B, it means\nthat including A in an app does not force B to be included too — but,\nif B is included or by another package, then B will load before A.\nYou can use this to make packages that optionally integrate with or\nenhance other packages if those packages are present.\nWhen you weakly depend on a package you don't see its exports.\nYou can detect if the possibly-present weakly-depended-on package\nis there by seeing if Package.foo exists, and get its exports\nfrom the same place.

","name":"weak"},{"type":{"names":["Boolean"]},"description":"

It's okay to load this dependency\nafter your package. (In general, dependencies specified by api.use\nare loaded before your package.) You can use this option to break\ncircular dependencies.

","name":"unordered"}],"locus":"package.js"},"PackageAPI#imply":{"memberof":"PackageAPI","summary":"Give users of this package access to another package (by passing in the string `packagename`) or a collection of packages (by passing in an array of strings [`packagename1`, `packagename2`]","scope":"instance","params":[{"type":{"names":["String","Array."]},"description":"

Name of a package, or array of package names, with an optional @version component for each.

","name":"packageSpecs"}],"name":"imply","longname":"PackageAPI#imply","kind":"function","options":[],"locus":"package.js"},"PackageAPI#addFiles":{"memberof":"PackageAPI","scope":"instance","summary":"Specify the source code for your package.","params":[{"type":{"names":["String","Array."]},"description":"

Name of the source file, or array of strings of source file names.

","name":"filename"},{"type":{"names":["String"]},"optional":true,"description":"

If you only want to export the file on the server (or the client), you can pass in the second argument (e.g., 'server' or 'client') to specify what architecture the file is used with.

","name":"architecture"}],"name":"addFiles","longname":"PackageAPI#addFiles","kind":"function","options":[],"locus":"package.js"},"PackageAPI#versionsFrom":{"memberof":"PackageAPI","scope":"instance","summary":"Use versions of core packages from a release. Unless provided, all packages will default to the versions released along with `meteorRelease`. This will save you from having to figure out the exact versions of the core packages you want to use. For example, if the newest release of meteor is `METEOR@0.9.0` and it includes `jquery@1.0.0`, you can write `api.versionsFrom('METEOR@0.9.0')` in your package, and when you later write `api.use('jquery')`, it will be equivalent to `api.use('jquery@1.0.0')`. You may specify an array of multiple releases, in which case the default value for constraints will be the \"or\" of the versions from each release: `api.versionsFrom(['METEOR@0.9.0', 'METEOR@0.9.5'])` may cause `api.use('jquery')` to be interpreted as `api.use('jquery@1.0.0 || 2.0.0')`.","params":[{"type":{"names":["String","Array."]},"description":"

Specification of a release: track@version. Just 'version' (e.g. "0.9.0") is sufficient if using the default release track METEOR.

","name":"meteorRelease"}],"name":"versionsFrom","longname":"PackageAPI#versionsFrom","kind":"function","options":[],"locus":"package.js"},"PackageAPI#export":{"memberof":"PackageAPI","scope":"instance","summary":"Export package-level variables in your package. The specified variables (declared without `var` in the source code) will be available to packages that use this package.","params":[{"type":{"names":["String"]},"description":"

Name of the object.

","name":"exportedObject"},{"type":{"names":["String"]},"optional":true,"description":"

If you only want to export the object on the server (or the client), you can pass in the second argument (e.g., 'server' or 'client') to specify what architecture the export is used with.

","name":"architecture"}],"name":"export","longname":"PackageAPI#export","kind":"function","options":[],"locus":"package.js"},"Subscription":{"summary":"The server's side of a subscription","kind":"class","name":"Subscription","longname":"Subscription","options":[],"params":[],"instancename":"this"},"ReactiveVar":{"kind":"class","summary":"Constructor for a ReactiveVar, which represents a single reactive variable.","params":[{"type":{"names":["Any"]},"description":"

The initial value to set. equalsFunc is ignored when setting the initial value.

","name":"initialValue"},{"type":{"names":["function"]},"optional":true,"description":"

Optional. A function of two arguments, called on the old value and the new value whenever the ReactiveVar is set. If it returns true, no set is performed. If omitted, the default equalsFunc returns true if its arguments are === and are of type number, boolean, string, undefined, or null.

","name":"equalsFunc"}],"name":"ReactiveVar","longname":"ReactiveVar","scope":"global","options":[],"instancename":"reactiveVar","locus":"Client"},"CompileStep":{"description":"

The comments for this class aren't used to generate docs right now.\nThe docs live in the GitHub Wiki at: https://github.com/meteor/meteor/wiki/CompileStep-API-for-Build-Plugin-Source-Handlers

","kind":"class","name":"CompileStep","summary":"The object passed into Plugin.registerSourceHandler","scope":"global","longname":"CompileStep","options":[],"params":[]},"PackageAPI":{"kind":"class","name":"PackageAPI","scope":"global","summary":"The API object passed into the Packages.onUse function.","longname":"PackageAPI","options":[],"params":[],"instancename":"api"}}; \ No newline at end of file diff --git a/docs/client/docs.css b/docs/client/docs.css index 855fe6d2dd..9e1afcc1f3 100644 --- a/docs/client/docs.css +++ b/docs/client/docs.css @@ -42,8 +42,12 @@ pre { code { font-family: monospace; - font-size: 1.1em; white-space: pre; + font-size: 1.2em; +} + +pre code { + font-size: 1.1em; } ul { @@ -392,23 +396,7 @@ h3.api-title { } #main pre { - -moz-border-radius: 10px; - -webkit-border-radius: 10px; - -o-border-radius: 10px; - -ms-border-radius: 10px; - -khtml-border-radius: 10px; - border-radius: 10px; - border-color: #777; - border-style: solid; - background-color: white; - border-width: 1px; - padding: 5px; - margin: 1em 0 1em 0; -} - -#main pre, #main pre code { /* override inline code font and white-space*/ - font-size: 12px; - font-weight: bold; + margin: 1em 0; } #main a.selflink:link, #main a.selflink:visited, #main a.selflink:hover { diff --git a/docs/client/docs.js b/docs/client/docs.js index 20f06d6f9d..68c0e52119 100644 --- a/docs/client/docs.js +++ b/docs/client/docs.js @@ -1,16 +1,12 @@ +var release = Meteor.release ? "0.9.4" : "(checkout)"; + Template.headline.helpers({ release: function () { - return Meteor.release ? "0.9.4-pre.11" : "(checkout)"; + return release; } }); Meteor.startup(function () { - // XXX this is broken by the new multi-page layout. Also, it was - // broken before the multi-page layout because it had illegible - // colors. Just turn it off for now. We'll fix it and turn it on - // later. - // prettyPrint(); - //mixpanel tracking mixpanel.track('docs'); @@ -103,7 +99,7 @@ var hideMenu = function () { }; var toc = [ - {name: "Meteor " + Template.headline.release(), id: "top"}, [ + {name: "Meteor " + release, id: "top"}, [ "Quick start", "Seven principles", "Resources" @@ -402,7 +398,7 @@ var toc = [ {name: "mobile-config.js", id: "mobileconfigjs"}, [ {name: "App.info", id: "App-info"}, - {name: "App.set", id: "App-set"}, + {name: "App.setPreference", id: "App-setPreference"}, {name: "App.configurePlugin", id: "App-configurePlugin"}, {name: "App.icons", id: "App-icons"}, {name: "App.launchScreens", id: "App-launchScreens"} @@ -411,17 +407,13 @@ var toc = [ "Packages", [ [ "accounts-ui", - "appcache", "audit-argument-checks", - "browser-policy", "coffeescript", "fastclick", - "force-ssl", "jquery", "less", "oauth-encryption", "random", - "spiderable", "stylus", "showdown", "underscore", diff --git a/docs/client/introduction.html b/docs/client/introduction.html index 54cf0296f4..8daebd1fed 100644 --- a/docs/client/introduction.html +++ b/docs/client/introduction.html @@ -43,29 +43,29 @@ platforms](https://github.com/meteor/meteor/wiki/Supported-Platforms). Install Meteor: -
+```
 $ curl https://install.meteor.com | /bin/sh
-
+``` Create a project: -
+```
 $ meteor create myapp
-
+``` Run it locally: -
+```
 $ cd myapp
 $ meteor
-=> Meteor server running on: http://localhost:3000/
-
+# Meteor server running on: http://localhost:3000/ +``` Unleash it on the world (on a free server we provide): -
+```
 $ meteor deploy myapp.meteor.com
-
+```

Seven Principles of Meteor

diff --git a/docs/client/packages.html b/docs/client/packages.html index d79071ccf1..fb5dc8c090 100644 --- a/docs/client/packages.html +++ b/docs/client/packages.html @@ -19,17 +19,13 @@ and removed with: Meteor Development Group maintains the following packages: {{> pkg_accounts_ui}} -{{> pkg_appcache}} {{> pkg_audit_argument_checks}} -{{> pkg_browser_policy}} {{> pkg_coffeescript}} {{> pkg_fastclick}} -{{> pkg_force_ssl}} {{> pkg_jquery}} {{> pkg_less}} {{> pkg_oauth_encryption}} {{> pkg_random}} -{{> pkg_spiderable}} {{> pkg_stylus}} {{> pkg_showdown}} {{> pkg_underscore}} diff --git a/examples/clock/.meteor/.finished-upgraders b/examples/clock/.meteor/.finished-upgraders index ee0ed5a316..68df3d8d0d 100644 --- a/examples/clock/.meteor/.finished-upgraders +++ b/examples/clock/.meteor/.finished-upgraders @@ -4,3 +4,4 @@ notices-for-0.9.0 notices-for-0.9.1 +0.9.4-platform-file diff --git a/examples/clock/.meteor/platforms b/examples/clock/.meteor/platforms new file mode 100644 index 0000000000..efeba1b50c --- /dev/null +++ b/examples/clock/.meteor/platforms @@ -0,0 +1,2 @@ +server +browser diff --git a/examples/clock/.meteor/release b/examples/clock/.meteor/release index 7b32bf7a26..7057f80807 100644 --- a/examples/clock/.meteor/release +++ b/examples/clock/.meteor/release @@ -1 +1 @@ -METEOR@0.9.3 +METEOR@0.9.4 diff --git a/examples/clock/.meteor/versions b/examples/clock/.meteor/versions index c243175ecf..d2447bbfec 100644 --- a/examples/clock/.meteor/versions +++ b/examples/clock/.meteor/versions @@ -1,52 +1,52 @@ -application-configuration@1.0.2 -autopublish@1.0.0 -autoupdate@1.1.1 -base64@1.0.0 -binary-heap@1.0.0 -blaze-tools@1.0.0 -blaze@2.0.1 -boilerplate-generator@1.0.0 -callback-hook@1.0.0 -check@1.0.1 -ctl-helper@1.0.3 -ctl@1.0.1 -ddp@1.0.9 -deps@1.0.4 -ejson@1.0.3 -fastclick@1.0.0 -follower-livedata@1.0.1 -geojson-utils@1.0.0 -html-tools@1.0.1 -htmljs@1.0.1 -http@1.0.6 -id-map@1.0.0 -insecure@1.0.0 -jquery@1.0.0 -json@1.0.0 -livedata@1.0.10 -logging@1.0.3 -meteor-platform@1.1.1 -meteor@1.1.1 -minifiers@1.1.0 -minimongo@1.0.3 -mobile-status-bar@1.0.0 -mongo@1.0.6 -observe-sequence@1.0.2 -ordered-dict@1.0.0 -random@1.0.0 -reactive-dict@1.0.3 -reactive-var@1.0.2 -reload@1.1.0 -retry@1.0.0 -routepolicy@1.0.1 -session@1.0.2 -spacebars-compiler@1.0.2 -spacebars@1.0.2 -standard-app-packages@1.0.2 -templating@1.0.7 -tracker@1.0.2 -ui@1.0.3 -underscore@1.0.0 -url@1.0.0 -webapp-hashing@1.0.0 -webapp@1.1.2 +application-configuration@1.0.3 +autopublish@1.0.1 +autoupdate@1.1.2 +base64@1.0.1 +binary-heap@1.0.1 +blaze-tools@1.0.1 +blaze@2.0.2 +boilerplate-generator@1.0.1 +callback-hook@1.0.1 +check@1.0.2 +ctl-helper@1.0.4 +ctl@1.0.2 +ddp@1.0.10 +deps@1.0.5 +ejson@1.0.4 +fastclick@1.0.1 +follower-livedata@1.0.2 +geojson-utils@1.0.1 +html-tools@1.0.2 +htmljs@1.0.2 +http@1.0.7 +id-map@1.0.1 +insecure@1.0.1 +jquery@1.0.1 +json@1.0.1 +livedata@1.0.11 +logging@1.0.4 +meteor-platform@1.1.2 +meteor@1.1.2 +minifiers@1.1.1 +minimongo@1.0.4 +mobile-status-bar@1.0.1 +mongo@1.0.7 +observe-sequence@1.0.3 +ordered-dict@1.0.1 +random@1.0.1 +reactive-dict@1.0.4 +reactive-var@1.0.3 +reload@1.1.1 +retry@1.0.1 +routepolicy@1.0.2 +session@1.0.3 +spacebars-compiler@1.0.3 +spacebars@1.0.3 +standard-app-packages@1.0.3 +templating@1.0.8 +tracker@1.0.3 +ui@1.0.4 +underscore@1.0.1 +url@1.0.1 +webapp-hashing@1.0.1 +webapp@1.1.3 diff --git a/examples/leaderboard/.meteor/.finished-upgraders b/examples/leaderboard/.meteor/.finished-upgraders index ee0ed5a316..68df3d8d0d 100644 --- a/examples/leaderboard/.meteor/.finished-upgraders +++ b/examples/leaderboard/.meteor/.finished-upgraders @@ -4,3 +4,4 @@ notices-for-0.9.0 notices-for-0.9.1 +0.9.4-platform-file diff --git a/examples/leaderboard/.meteor/cordova-platforms b/examples/leaderboard/.meteor/cordova-platforms deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/examples/leaderboard/.meteor/platforms b/examples/leaderboard/.meteor/platforms new file mode 100644 index 0000000000..efeba1b50c --- /dev/null +++ b/examples/leaderboard/.meteor/platforms @@ -0,0 +1,2 @@ +server +browser diff --git a/examples/leaderboard/.meteor/release b/examples/leaderboard/.meteor/release index 7b32bf7a26..7057f80807 100644 --- a/examples/leaderboard/.meteor/release +++ b/examples/leaderboard/.meteor/release @@ -1 +1 @@ -METEOR@0.9.3 +METEOR@0.9.4 diff --git a/examples/leaderboard/.meteor/versions b/examples/leaderboard/.meteor/versions index c243175ecf..d2447bbfec 100644 --- a/examples/leaderboard/.meteor/versions +++ b/examples/leaderboard/.meteor/versions @@ -1,52 +1,52 @@ -application-configuration@1.0.2 -autopublish@1.0.0 -autoupdate@1.1.1 -base64@1.0.0 -binary-heap@1.0.0 -blaze-tools@1.0.0 -blaze@2.0.1 -boilerplate-generator@1.0.0 -callback-hook@1.0.0 -check@1.0.1 -ctl-helper@1.0.3 -ctl@1.0.1 -ddp@1.0.9 -deps@1.0.4 -ejson@1.0.3 -fastclick@1.0.0 -follower-livedata@1.0.1 -geojson-utils@1.0.0 -html-tools@1.0.1 -htmljs@1.0.1 -http@1.0.6 -id-map@1.0.0 -insecure@1.0.0 -jquery@1.0.0 -json@1.0.0 -livedata@1.0.10 -logging@1.0.3 -meteor-platform@1.1.1 -meteor@1.1.1 -minifiers@1.1.0 -minimongo@1.0.3 -mobile-status-bar@1.0.0 -mongo@1.0.6 -observe-sequence@1.0.2 -ordered-dict@1.0.0 -random@1.0.0 -reactive-dict@1.0.3 -reactive-var@1.0.2 -reload@1.1.0 -retry@1.0.0 -routepolicy@1.0.1 -session@1.0.2 -spacebars-compiler@1.0.2 -spacebars@1.0.2 -standard-app-packages@1.0.2 -templating@1.0.7 -tracker@1.0.2 -ui@1.0.3 -underscore@1.0.0 -url@1.0.0 -webapp-hashing@1.0.0 -webapp@1.1.2 +application-configuration@1.0.3 +autopublish@1.0.1 +autoupdate@1.1.2 +base64@1.0.1 +binary-heap@1.0.1 +blaze-tools@1.0.1 +blaze@2.0.2 +boilerplate-generator@1.0.1 +callback-hook@1.0.1 +check@1.0.2 +ctl-helper@1.0.4 +ctl@1.0.2 +ddp@1.0.10 +deps@1.0.5 +ejson@1.0.4 +fastclick@1.0.1 +follower-livedata@1.0.2 +geojson-utils@1.0.1 +html-tools@1.0.2 +htmljs@1.0.2 +http@1.0.7 +id-map@1.0.1 +insecure@1.0.1 +jquery@1.0.1 +json@1.0.1 +livedata@1.0.11 +logging@1.0.4 +meteor-platform@1.1.2 +meteor@1.1.2 +minifiers@1.1.1 +minimongo@1.0.4 +mobile-status-bar@1.0.1 +mongo@1.0.7 +observe-sequence@1.0.3 +ordered-dict@1.0.1 +random@1.0.1 +reactive-dict@1.0.4 +reactive-var@1.0.3 +reload@1.1.1 +retry@1.0.1 +routepolicy@1.0.2 +session@1.0.3 +spacebars-compiler@1.0.3 +spacebars@1.0.3 +standard-app-packages@1.0.3 +templating@1.0.8 +tracker@1.0.3 +ui@1.0.4 +underscore@1.0.1 +url@1.0.1 +webapp-hashing@1.0.1 +webapp@1.1.3 diff --git a/examples/parties/.meteor/.finished-upgraders b/examples/parties/.meteor/.finished-upgraders index ee0ed5a316..68df3d8d0d 100644 --- a/examples/parties/.meteor/.finished-upgraders +++ b/examples/parties/.meteor/.finished-upgraders @@ -4,3 +4,4 @@ notices-for-0.9.0 notices-for-0.9.1 +0.9.4-platform-file diff --git a/examples/parties/.meteor/platforms b/examples/parties/.meteor/platforms new file mode 100644 index 0000000000..efeba1b50c --- /dev/null +++ b/examples/parties/.meteor/platforms @@ -0,0 +1,2 @@ +server +browser diff --git a/examples/parties/.meteor/release b/examples/parties/.meteor/release index 7b32bf7a26..7057f80807 100644 --- a/examples/parties/.meteor/release +++ b/examples/parties/.meteor/release @@ -1 +1 @@ -METEOR@0.9.3 +METEOR@0.9.4 diff --git a/examples/parties/.meteor/versions b/examples/parties/.meteor/versions index 7245eb8d10..a9ab23068b 100644 --- a/examples/parties/.meteor/versions +++ b/examples/parties/.meteor/versions @@ -1,72 +1,72 @@ -accounts-base@1.1.1 -accounts-facebook@1.0.1 -accounts-oauth@1.1.1 -accounts-password@1.0.2 -accounts-twitter@1.0.1 -accounts-ui-unstyled@1.1.2 -accounts-ui@1.1.1 -application-configuration@1.0.2 -audit-argument-checks@1.0.0 -autoupdate@1.1.1 -base64@1.0.0 -binary-heap@1.0.0 -blaze-tools@1.0.0 -blaze@2.0.1 -boilerplate-generator@1.0.0 +accounts-base@1.1.2 +accounts-facebook@1.0.2 +accounts-oauth@1.1.2 +accounts-password@1.0.3 +accounts-twitter@1.0.2 +accounts-ui-unstyled@1.1.3 +accounts-ui@1.1.2 +application-configuration@1.0.3 +audit-argument-checks@1.0.1 +autoupdate@1.1.2 +base64@1.0.1 +binary-heap@1.0.1 +blaze-tools@1.0.1 +blaze@2.0.2 +boilerplate-generator@1.0.1 bootstrap@1.0.1 -callback-hook@1.0.0 -check@1.0.1 -ctl-helper@1.0.3 -ctl@1.0.1 +callback-hook@1.0.1 +check@1.0.2 +ctl-helper@1.0.4 +ctl@1.0.2 d3@1.0.0 -ddp@1.0.9 -deps@1.0.4 -ejson@1.0.3 -email@1.0.3 -facebook@1.1.0 -fastclick@1.0.0 -follower-livedata@1.0.1 -geojson-utils@1.0.0 -html-tools@1.0.1 -htmljs@1.0.1 -http@1.0.6 -id-map@1.0.0 -jquery@1.0.0 -json@1.0.0 -less@1.0.9 -livedata@1.0.10 -localstorage@1.0.0 -logging@1.0.3 -meteor-platform@1.1.1 -meteor@1.1.1 -minifiers@1.1.0 -minimongo@1.0.3 -mobile-status-bar@1.0.0 -mongo@1.0.6 +ddp@1.0.10 +deps@1.0.5 +ejson@1.0.4 +email@1.0.4 +facebook@1.1.1 +fastclick@1.0.1 +follower-livedata@1.0.2 +geojson-utils@1.0.1 +html-tools@1.0.2 +htmljs@1.0.2 +http@1.0.7 +id-map@1.0.1 +jquery@1.0.1 +json@1.0.1 +less@1.0.10 +livedata@1.0.11 +localstorage@1.0.1 +logging@1.0.4 +meteor-platform@1.1.2 +meteor@1.1.2 +minifiers@1.1.1 +minimongo@1.0.4 +mobile-status-bar@1.0.1 +mongo@1.0.7 npm-bcrypt@0.7.7 -oauth1@1.1.0 -oauth2@1.1.0 -oauth@1.1.0 -observe-sequence@1.0.2 -ordered-dict@1.0.0 -random@1.0.0 -reactive-dict@1.0.3 -reactive-var@1.0.2 -reload@1.1.0 -retry@1.0.0 -routepolicy@1.0.1 -service-configuration@1.0.1 -session@1.0.2 -sha@1.0.0 -spacebars-compiler@1.0.2 -spacebars@1.0.2 -srp@1.0.0 -standard-app-packages@1.0.2 -templating@1.0.7 -tracker@1.0.2 -twitter@1.1.0 -ui@1.0.3 -underscore@1.0.0 -url@1.0.0 -webapp-hashing@1.0.0 -webapp@1.1.2 +oauth1@1.1.1 +oauth2@1.1.1 +oauth@1.1.1 +observe-sequence@1.0.3 +ordered-dict@1.0.1 +random@1.0.1 +reactive-dict@1.0.4 +reactive-var@1.0.3 +reload@1.1.1 +retry@1.0.1 +routepolicy@1.0.2 +service-configuration@1.0.2 +session@1.0.3 +sha@1.0.1 +spacebars-compiler@1.0.3 +spacebars@1.0.3 +srp@1.0.1 +standard-app-packages@1.0.3 +templating@1.0.8 +tracker@1.0.3 +twitter@1.1.1 +ui@1.0.4 +underscore@1.0.1 +url@1.0.1 +webapp-hashing@1.0.1 +webapp@1.1.3 diff --git a/examples/parties/client/client.js b/examples/parties/client/client.js index 69d33a51f5..be6c2e43f2 100644 --- a/examples/parties/client/client.js +++ b/examples/parties/client/client.js @@ -5,7 +5,7 @@ Meteor.subscribe("parties"); // If no party selected, or if the selected party was deleted, select one. Meteor.startup(function () { - Deps.autorun(function () { + Tracker.autorun(function () { var selected = Session.get("selected"); if (! selected || ! Parties.findOne(selected)) { var party = Parties.findOne(); @@ -130,7 +130,7 @@ Template.map.rendered = function () { self.node = self.find("svg"); if (! self.handle) { - self.handle = Deps.autorun(function () { + self.handle = Tracker.autorun(function () { var selected = Session.get('selected'); var selectedParty = selected && Parties.findOne(selected); var radius = function (party) { diff --git a/examples/todos/.meteor/packages b/examples/todos/.meteor/packages index b9dd328d10..584b918846 100644 --- a/examples/todos/.meteor/packages +++ b/examples/todos/.meteor/packages @@ -8,6 +8,3 @@ insecure less iron:router accounts-password -fastclick -noorderstorm:hammer - diff --git a/examples/todos/.meteor/release b/examples/todos/.meteor/release index 0b324bf505..7057f80807 100644 --- a/examples/todos/.meteor/release +++ b/examples/todos/.meteor/release @@ -1 +1 @@ -METEOR@0.9.4-pre.8 +METEOR@0.9.4 diff --git a/examples/todos/.meteor/versions b/examples/todos/.meteor/versions index 3ab316d172..c64ef0a6d7 100644 --- a/examples/todos/.meteor/versions +++ b/examples/todos/.meteor/versions @@ -1,65 +1,65 @@ -accounts-base@1.1.2-pre.2 -accounts-password@1.0.3-pre.2 -application-configuration@1.0.3-pre.2 -autoupdate@1.1.2-pre.3 -base64@1.0.1-pre.2 -binary-heap@1.0.1-pre.2 -blaze-tools@1.0.1-pre.2 -blaze@2.0.2-pre.2 -boilerplate-generator@1.0.1-pre.3 -callback-hook@1.0.1-pre.2 -check@1.0.2-pre.2 -ctl-helper@1.0.4-pre.2 -ctl@1.0.2-pre.2 -ddp@1.0.10-pre.2 -deps@1.0.5-pre.2 -ejson@1.0.4-pre.2 -email@1.0.4-pre.2 -fastclick@1.0.1-pre.3 -follower-livedata@1.0.2-pre.2 -geojson-utils@1.0.1-pre.2 -html-tools@1.0.2-pre.2 -htmljs@1.0.2-pre.3 -http@1.0.7-pre.2 -id-map@1.0.1-pre.2 -insecure@1.0.1-pre.2 +accounts-base@1.1.2 +accounts-password@1.0.3 +application-configuration@1.0.3 +autoupdate@1.1.2 +base64@1.0.1 +binary-heap@1.0.1 +blaze-tools@1.0.1 +blaze@2.0.2 +boilerplate-generator@1.0.1 +callback-hook@1.0.1 +check@1.0.2 +ctl-helper@1.0.4 +ctl@1.0.2 +ddp@1.0.10 +deps@1.0.5 +ejson@1.0.4 +email@1.0.4 +fastclick@1.0.1 +follower-livedata@1.0.2 +geojson-utils@1.0.1 +html-tools@1.0.2 +htmljs@1.0.2 +http@1.0.7 +id-map@1.0.1 +insecure@1.0.1 iron:core@0.3.4 iron:dynamic-template@0.4.1 iron:layout@0.4.1 iron:router@0.9.4 -jquery@1.0.1-pre.2 -json@1.0.1-pre.2 -less@1.0.10-pre.3 -livedata@1.0.11-pre.2 -localstorage@1.0.1-pre.2 -logging@1.0.4-pre.2 -meteor-platform@1.1.2-pre.3 -meteor@1.1.2-pre.3 -minifiers@1.1.1-pre.2 -minimongo@1.0.4-pre.3 -mobile-status-bar@1.0.1-pre.2 -mongo@1.0.7-pre.2 -noorderstorm:hammer@0.1.3 +jquery@1.0.1 +json@1.0.1 +launch-screen@1.0.0 +less@1.0.10 +livedata@1.0.11 +localstorage@1.0.1 +logging@1.0.4 +meteor-platform@1.1.2 +meteor@1.1.2 +minifiers@1.1.1 +minimongo@1.0.4 +mobile-status-bar@1.0.1 +mongo@1.0.7 npm-bcrypt@0.7.7 -observe-sequence@1.0.3-pre.2 -ordered-dict@1.0.1-pre.2 -random@1.0.1-pre.2 -reactive-dict@1.0.4-pre.2 -reactive-var@1.0.3-pre.2 -reload@1.1.1-pre.2 -retry@1.0.1-pre.2 -routepolicy@1.0.2-pre.2 -service-configuration@1.0.2-pre.2 -session@1.0.3-pre.2 -sha@1.0.1-pre.2 -spacebars-compiler@1.0.3-pre.2 -spacebars@1.0.3-pre.2 -srp@1.0.1-pre.1 -standard-app-packages@1.0.3-pre.2 -templating@1.0.8-pre.3 -tracker@1.0.3-pre.2 -ui@1.0.4-pre.2 -underscore@1.0.1-pre.2 -url@1.0.1-pre.2 -webapp-hashing@1.0.1-pre.2 -webapp@1.1.3-pre.3 +observe-sequence@1.0.3 +ordered-dict@1.0.1 +random@1.0.1 +reactive-dict@1.0.4 +reactive-var@1.0.3 +reload@1.1.1 +retry@1.0.1 +routepolicy@1.0.2 +service-configuration@1.0.2 +session@1.0.3 +sha@1.0.1 +spacebars-compiler@1.0.3 +spacebars@1.0.3 +srp@1.0.1 +standard-app-packages@1.0.3 +templating@1.0.8 +tracker@1.0.3 +ui@1.0.4 +underscore@1.0.1 +url@1.0.1 +webapp-hashing@1.0.1 +webapp@1.1.3 diff --git a/examples/todos/client/lib/jquery.touchwipe.js b/examples/todos/client/lib/jquery.touchwipe.js new file mode 100644 index 0000000000..18264774f7 --- /dev/null +++ b/examples/todos/client/lib/jquery.touchwipe.js @@ -0,0 +1,82 @@ +/** + * jQuery Plugin to obtain touch gestures from iPhone, iPod Touch and iPad, should also work with Android mobile phones (not tested yet!) + * Common usage: wipe images (left and right to show the previous or next image) + * + * @author Andreas Waltl, netCU Internetagentur (http://www.netcu.de) + * @version 1.1.1 (9th December 2010) - fix bug (older IE's had problems) + * @version 1.1 (1st September 2010) - support wipe up and wipe down + * @version 1.0 (15th July 2010) + */ +(function($) { + $.fn.touchwipe = function(settings) { + var config = { + min_move_x: 20, + min_move_y: 20, + wipeLeft: function() { }, + wipeRight: function() { }, + wipeUp: function() { }, + wipeDown: function() { }, + preventDefaultEvents: true + }; + + if (settings) $.extend(config, settings); + + this.each(function() { + var startX; + var startY; + var isMoving = false; + + function cancelTouch() { + this.removeEventListener('touchmove', onTouchMove); + startX = null; + isMoving = false; + } + + function onTouchMove(e) { + if(config.preventDefaultEvents) { + e.preventDefault(); + } + if(isMoving) { + var x = e.touches[0].pageX; + var y = e.touches[0].pageY; + var dx = startX - x; + var dy = startY - y; + if(Math.abs(dx) >= config.min_move_x) { + cancelTouch(); + if(dx > 0) { + config.wipeLeft(); + } + else { + config.wipeRight(); + } + } + else if(Math.abs(dy) >= config.min_move_y) { + cancelTouch(); + if(dy > 0) { + config.wipeDown(); + } + else { + config.wipeUp(); + } + } + } + } + + function onTouchStart(e) + { + if (e.touches.length == 1) { + startX = e.touches[0].pageX; + startY = e.touches[0].pageY; + isMoving = true; + this.addEventListener('touchmove', onTouchMove, false); + } + } + if ('ontouchstart' in document.documentElement) { + this.addEventListener('touchstart', onTouchStart, false); + } + }); + + return this; + }; + + })(jQuery); diff --git a/examples/todos/client/stylesheets/globals/base.lessimport b/examples/todos/client/stylesheets/globals/base.import.less similarity index 100% rename from examples/todos/client/stylesheets/globals/base.lessimport rename to examples/todos/client/stylesheets/globals/base.import.less diff --git a/examples/todos/client/stylesheets/globals/button.lessimport b/examples/todos/client/stylesheets/globals/button.import.less similarity index 100% rename from examples/todos/client/stylesheets/globals/button.lessimport rename to examples/todos/client/stylesheets/globals/button.import.less diff --git a/examples/todos/client/stylesheets/globals/form.lessimport b/examples/todos/client/stylesheets/globals/form.import.less similarity index 100% rename from examples/todos/client/stylesheets/globals/form.lessimport rename to examples/todos/client/stylesheets/globals/form.import.less diff --git a/examples/todos/client/stylesheets/globals/icon.lessimport b/examples/todos/client/stylesheets/globals/icon.import.less similarity index 71% rename from examples/todos/client/stylesheets/globals/icon.lessimport rename to examples/todos/client/stylesheets/globals/icon.import.less index 1f385cb411..6be0db9436 100644 --- a/examples/todos/client/stylesheets/globals/icon.lessimport +++ b/examples/todos/client/stylesheets/globals/icon.import.less @@ -1,10 +1,10 @@ @font-face { font-family: 'todos'; - src:url('icon/todos.eot?o4fu7p'); - src:url('icon/todos.eot?#iefixo4fu7p') format('embedded-opentype'), - url('icon/todos.woff?o4fu7p') format('woff'), - url('icon/todos.ttf?o4fu7p') format('truetype'), - url('icon/todos.svg?o4fu7p#todos') format('svg'); + src:url('icon/todos.eot?-5w3um4'); + src:url('icon/todos.eot?#iefix5w3um4') format('embedded-opentype'), + url('icon/todos.woff?5w3um4') format('woff'), + url('icon/todos.ttf?5w3um4') format('truetype'), + url('icon/todos.svg?5w3um4#todos') format('svg'); font-weight: normal; font-style: normal; } @@ -23,9 +23,13 @@ -moz-osx-font-smoothing: grayscale; } + .icon-unlock:before { content: "\e600"; } +.icon-user-add:before { + content: "\e604"; +} .icon-cog:before { content: "\e606"; } @@ -44,6 +48,9 @@ .icon-close:before { content: "\e60c"; } +.icon-cross:before { + content: "\e60d"; +} .icon-sync:before { content: "\e60e"; } @@ -53,6 +60,9 @@ .icon-check:before { content: "\e612"; } +.icon-share:before { + content: "\e617"; +} .icon-email:before { content: "\e619"; } diff --git a/examples/todos/client/stylesheets/globals/layout.lessimport b/examples/todos/client/stylesheets/globals/layout.import.less similarity index 85% rename from examples/todos/client/stylesheets/globals/layout.lessimport rename to examples/todos/client/stylesheets/globals/layout.import.less index 5cefa02a14..75ecccaa05 100644 --- a/examples/todos/client/stylesheets/globals/layout.lessimport +++ b/examples/todos/client/stylesheets/globals/layout.import.less @@ -37,6 +37,10 @@ body { background: @color-tertiary; opacity: 1; + @media screen and (min-width: 40em) { + left: @menu-width; + } + .content-scrollable { .position(absolute, 0, 0, 0, 0); .transform(translate3d(0, 0, 0)); @@ -48,13 +52,14 @@ body { .menu-open & { .transform(translate3d(@menu-width, 0, 0)); opacity: .85; - } + left: 0; - // Show menu on desktop, negate .menu-open - @media screen and (min-width: 40em) { - .transform(translate3d(0, 0, 0)); //reset transform and use position properties instead - left: @menu-width; - opacity: 1; + @media screen and (min-width: 40em) { + // Show menu on desktop, negate .menu-open + .transform(translate3d(0, 0, 0)); //reset transform and use position properties instead + opacity: 1; + left: @menu-width; + } } } diff --git a/examples/todos/client/stylesheets/globals/link.lessimport b/examples/todos/client/stylesheets/globals/link.import.less similarity index 100% rename from examples/todos/client/stylesheets/globals/link.lessimport rename to examples/todos/client/stylesheets/globals/link.import.less diff --git a/examples/todos/client/stylesheets/globals/list-items.lessimport b/examples/todos/client/stylesheets/globals/list-items.import.less similarity index 100% rename from examples/todos/client/stylesheets/globals/list-items.lessimport rename to examples/todos/client/stylesheets/globals/list-items.import.less diff --git a/examples/todos/client/stylesheets/globals/menu.lessimport b/examples/todos/client/stylesheets/globals/menu.import.less similarity index 92% rename from examples/todos/client/stylesheets/globals/menu.lessimport rename to examples/todos/client/stylesheets/globals/menu.import.less index 0ef6c0521c..a842950809 100644 --- a/examples/todos/client/stylesheets/globals/menu.lessimport +++ b/examples/todos/client/stylesheets/globals/menu.import.less @@ -85,6 +85,11 @@ color: @color-empty; .count-list { background: @color-primary; } } + + .cordova &:hover { + // Prevent hover states from being noticeable on Cordova apps + color: rgba(255,255,255,.4); + } } } } \ No newline at end of file diff --git a/examples/todos/client/stylesheets/globals/message.lessimport b/examples/todos/client/stylesheets/globals/message.import.less similarity index 100% rename from examples/todos/client/stylesheets/globals/message.lessimport rename to examples/todos/client/stylesheets/globals/message.import.less diff --git a/examples/todos/client/stylesheets/globals/nav.lessimport b/examples/todos/client/stylesheets/globals/nav.import.less similarity index 100% rename from examples/todos/client/stylesheets/globals/nav.lessimport rename to examples/todos/client/stylesheets/globals/nav.import.less diff --git a/examples/todos/client/stylesheets/globals/notification.lessimport b/examples/todos/client/stylesheets/globals/notification.import.less similarity index 100% rename from examples/todos/client/stylesheets/globals/notification.lessimport rename to examples/todos/client/stylesheets/globals/notification.import.less diff --git a/examples/todos/client/stylesheets/main.less b/examples/todos/client/stylesheets/main.less index 93b78465ac..69d5c249e7 100644 --- a/examples/todos/client/stylesheets/main.less +++ b/examples/todos/client/stylesheets/main.less @@ -1,29 +1,29 @@ -@import 'util/reset.lessimport'; +@import 'util/reset.import.less'; // Mixins & utilities -@import 'util/helpers.lessimport'; -@import 'util/lesshat.lessimport'; -@import 'util/text.lessimport'; -@import 'util/typography.lessimport'; -@import 'util/variables.lessimport'; +@import 'util/helpers.import.less'; +@import 'util/lesshat.import.less'; +@import 'util/text.import.less'; +@import 'util/typography.import.less'; +@import 'util/variables.import.less'; // Global namespace -@import 'globals/base.lessimport'; -@import 'globals/button.lessimport'; -@import 'globals/form.lessimport'; -@import 'globals/icon.lessimport'; -@import 'globals/layout.lessimport'; -@import 'globals/link.lessimport'; -@import 'globals/menu.lessimport'; -@import 'globals/nav.lessimport'; +@import 'globals/base.import.less'; +@import 'globals/button.import.less'; +@import 'globals/form.import.less'; +@import 'globals/icon.import.less'; +@import 'globals/layout.import.less'; +@import 'globals/link.import.less'; +@import 'globals/menu.import.less'; +@import 'globals/nav.import.less'; // Global templates -@import 'globals/list-items.lessimport'; -@import 'globals/message.lessimport'; -@import 'globals/notification.lessimport'; +@import 'globals/list-items.import.less'; +@import 'globals/message.import.less'; +@import 'globals/notification.import.less'; // Templates -@import '../templates/lists-show.lessimport'; -@import '../templates/auth.lessimport'; -@import '../templates/app-not-found.lessimport'; -@import '../templates/loading.lessimport'; \ No newline at end of file +@import '../templates/lists-show.import.less'; +@import '../templates/auth.import.less'; +@import '../templates/app-not-found.import.less'; +@import '../templates/loading.import.less'; \ No newline at end of file diff --git a/examples/todos/client/stylesheets/util/helpers.lessimport b/examples/todos/client/stylesheets/util/helpers.import.less similarity index 100% rename from examples/todos/client/stylesheets/util/helpers.lessimport rename to examples/todos/client/stylesheets/util/helpers.import.less diff --git a/examples/todos/client/stylesheets/util/lesshat.lessimport b/examples/todos/client/stylesheets/util/lesshat.import.less similarity index 100% rename from examples/todos/client/stylesheets/util/lesshat.lessimport rename to examples/todos/client/stylesheets/util/lesshat.import.less diff --git a/examples/todos/client/stylesheets/util/reset.lessimport b/examples/todos/client/stylesheets/util/reset.import.less similarity index 100% rename from examples/todos/client/stylesheets/util/reset.lessimport rename to examples/todos/client/stylesheets/util/reset.import.less diff --git a/examples/todos/client/stylesheets/util/text.lessimport b/examples/todos/client/stylesheets/util/text.import.less similarity index 100% rename from examples/todos/client/stylesheets/util/text.lessimport rename to examples/todos/client/stylesheets/util/text.import.less diff --git a/examples/todos/client/stylesheets/util/typography.lessimport b/examples/todos/client/stylesheets/util/typography.import.less similarity index 100% rename from examples/todos/client/stylesheets/util/typography.lessimport rename to examples/todos/client/stylesheets/util/typography.import.less diff --git a/examples/todos/client/stylesheets/util/variables.lessimport b/examples/todos/client/stylesheets/util/variables.import.less similarity index 100% rename from examples/todos/client/stylesheets/util/variables.lessimport rename to examples/todos/client/stylesheets/util/variables.import.less diff --git a/examples/todos/client/templates/app-body.html b/examples/todos/client/templates/app-body.html index 64dfff1fb5..5a4f8dbb8d 100644 --- a/examples/todos/client/templates/app-body.html +++ b/examples/todos/client/templates/app-body.html @@ -10,7 +10,7 @@ {{else}} {{/if}} - {{email}} + {{emailLocalPart}} {{#if userMenuOpen}} Logout @@ -31,10 +31,10 @@ {{#if userId}} {{/if}} - {{name}} {{#if incompleteCount}} {{incompleteCount}} {{/if}} + {{name}} {{/each}} diff --git a/examples/todos/client/templates/app-body.js b/examples/todos/client/templates/app-body.js index 221febaf62..ef5df616ae 100644 --- a/examples/todos/client/templates/app-body.js +++ b/examples/todos/client/templates/app-body.js @@ -4,21 +4,33 @@ Session.setDefault(MENU_KEY, false); var USER_MENU_KEY = 'userMenuOpen'; Session.setDefault(USER_MENU_KEY, false); +var SHOW_CONNECTION_ISSUE_KEY = 'showConnectionIssue'; +Session.setDefault(SHOW_CONNECTION_ISSUE_KEY, false); + +var CONNECTION_ISSUE_TIMEOUT = 1000; + +Meteor.startup(function () { + // set up a swipe left / right handler + $(document.body).touchwipe({ + wipeLeft: function () { + Session.set(MENU_KEY, false); + }, + wipeRight: function () { + Session.set(MENU_KEY, true); + }, + preventDefaultEvents: false + }); + + // Don't show the connection error box unless we haven't connected within + // 1 second of app starting + setTimeout(function () { + Session.set(SHOW_CONNECTION_ISSUE_KEY, true); + }, CONNECTION_ISSUE_TIMEOUT); +}); + Template.appBody.rendered = function() { - if (Meteor.isCordova) { - // set up a swipe left / right handler - this.hammer = new Hammer(this.find('#container')); - this.hammer.on('swipeleft swiperight', function(event) { - if (event.gesture.direction === 'right') { - Session.set(MENU_KEY, true); - } else if (event.gesture.direction === 'left') { - Session.set(MENU_KEY, false); - } - }); - } - this.find('#content-container')._uihooks = { - insertElement: function(node, next) {; + insertElement: function(node, next) { $(node) .hide() .insertBefore(next) @@ -32,12 +44,6 @@ Template.appBody.rendered = function() { }; }; -Template.appBody.destroyed = function() { - if (Meteor.isCordova) { - this.hammer.destroy(); - } -}; - Template.appBody.helpers({ // We use #each on an array of one item so that the "list" template is // removed and a new copy is added when changing lists, which is @@ -52,8 +58,9 @@ Template.appBody.helpers({ cordova: function() { return Meteor.isCordova && 'cordova'; }, - email: function() { - return Meteor.user().emails[0].address; + emailLocalPart: function() { + var email = Meteor.user().emails[0].address; + return email.substring(0, email.indexOf('@')); }, userMenuOpen: function() { return Session.get(USER_MENU_KEY); @@ -68,7 +75,11 @@ Template.appBody.helpers({ } }, connected: function() { - return Meteor.status().connected; + if (Session.get(SHOW_CONNECTION_ISSUE_KEY)) { + return Meteor.status().connected; + } else { + return true; + } } }); diff --git a/examples/todos/client/templates/app-not-found.lessimport b/examples/todos/client/templates/app-not-found.import.less similarity index 100% rename from examples/todos/client/templates/app-not-found.lessimport rename to examples/todos/client/templates/app-not-found.import.less diff --git a/examples/todos/client/templates/auth.lessimport b/examples/todos/client/templates/auth.import.less similarity index 100% rename from examples/todos/client/templates/auth.lessimport rename to examples/todos/client/templates/auth.import.less diff --git a/examples/todos/client/templates/lists-show.lessimport b/examples/todos/client/templates/lists-show.import.less similarity index 100% rename from examples/todos/client/templates/lists-show.lessimport rename to examples/todos/client/templates/lists-show.import.less diff --git a/examples/todos/client/templates/lists-show.js b/examples/todos/client/templates/lists-show.js index b684a914b0..483709d350 100644 --- a/examples/todos/client/templates/lists-show.js +++ b/examples/todos/client/templates/lists-show.js @@ -34,10 +34,9 @@ Template.listsShow.helpers({ var editList = function(list, template) { Session.set(EDITING_KEY, true); - // wait for the template to redraw based on the reactive change - Tracker.afterFlush(function() { - template.$('.js-edit-form input[type=text]').focus(); - }); + // force the template to redraw based on the reactive change + Tracker.flush(); + template.$('.js-edit-form input[type=text]').focus(); }; var saveList = function(list, template) { @@ -117,15 +116,13 @@ Template.listsShow.events({ 'change .list-edit': function(event, template) { if ($(event.target).val() === 'edit') { editList(this, template); - } else if ($(event.target).val() === 'delete') { - if (! deleteList(this, template)) { - // reset the select - event.target.selectedIndex = 0; - } + deleteList(this, template); } else { toggleListPrivacy(this, template); } + + event.target.selectedIndex = 0; }, 'click .js-edit-list': function(event, template) { diff --git a/examples/todos/client/templates/loading.lessimport b/examples/todos/client/templates/loading.import.less similarity index 100% rename from examples/todos/client/templates/loading.lessimport rename to examples/todos/client/templates/loading.import.less diff --git a/examples/todos/lib/router.js b/examples/todos/lib/router.js index 37cc7da856..7bc5d889cd 100644 --- a/examples/todos/lib/router.js +++ b/examples/todos/lib/router.js @@ -18,22 +18,32 @@ Router.configure({ } }); +if (Meteor.isClient) { + var launchScreenHandle = LaunchScreen.hold(); +} + Router.map(function() { this.route('join'); this.route('signin'); this.route('listsShow', { path: '/lists/:_id', - // subscribe to todos before the page is rendered but don't wait on the + // subscribe to todos before the page is rendered but don't wait on the // subscription, we'll just render the items as they arrive - onBeforeAction: function() { + onBeforeAction: function () { this.todosHandle = Meteor.subscribe('todos', this.params._id); }, - data: function() { + data: function () { return Lists.findOne(this.params._id); + }, + action: function () { + this.render(); + if (Meteor.isClient) { + launchScreenHandle.release(); + } } }); - + this.route('home', { path: '/', action: function() { @@ -45,4 +55,4 @@ Router.map(function() { if (Meteor.isClient) { Router.onBeforeAction('loading', {except: ['join', 'signin']}); Router.onBeforeAction('dataNotFound', {except: ['join', 'signin']}); -} \ No newline at end of file +} diff --git a/examples/todos/mobile-config.js b/examples/todos/mobile-config.js index acdbd59164..ae73b56247 100644 --- a/examples/todos/mobile-config.js +++ b/examples/todos/mobile-config.js @@ -7,13 +7,21 @@ App.info({ }); App.icons({ + // iOS 'iphone': 'resources/icons/icon-60.png', - 'iphone-2x': 'resources/icons/icon-60@2x.png', + 'iphone_2x': 'resources/icons/icon-60@2x.png', 'ipad': 'resources/icons/icon-72.png', - 'ipad-2x': 'resources/icons/icon-72@2x.png' + 'ipad_2x': 'resources/icons/icon-72@2x.png', + + // Android - XXX these are the same as iOS for now + 'android_ldpi': 'resources/icons/icon-60.png', + 'android_mdpi': 'resources/icons/icon-60.png', + 'android_hdpi': 'resources/icons/icon-72.png', + 'android_xhdpi': 'resources/icons/icon-72@2x.png' }); App.launchScreens({ + // iOS 'iphone': 'resources/splash/Default~iphone.png', 'iphone_2x': 'resources/splash/Default@2x~iphone.png', 'iphone5': 'resources/splash/Default-568h@2x~iphone.png', diff --git a/examples/todos/public/icon/todos.eot b/examples/todos/public/icon/todos.eot index d06f492e54..932ee9360d 100755 Binary files a/examples/todos/public/icon/todos.eot and b/examples/todos/public/icon/todos.eot differ diff --git a/examples/todos/public/icon/todos.svg b/examples/todos/public/icon/todos.svg index 720db28555..d6a1342c46 100755 --- a/examples/todos/public/icon/todos.svg +++ b/examples/todos/public/icon/todos.svg @@ -8,15 +8,18 @@ + - + + + diff --git a/examples/todos/public/icon/todos.ttf b/examples/todos/public/icon/todos.ttf index bfd1157ade..afd1056a94 100755 Binary files a/examples/todos/public/icon/todos.ttf and b/examples/todos/public/icon/todos.ttf differ diff --git a/examples/todos/public/icon/todos.woff b/examples/todos/public/icon/todos.woff index 2375068ccc..b9775341e7 100755 Binary files a/examples/todos/public/icon/todos.woff and b/examples/todos/public/icon/todos.woff differ diff --git a/examples/wordplay/.meteor/.finished-upgraders b/examples/wordplay/.meteor/.finished-upgraders index ee0ed5a316..68df3d8d0d 100644 --- a/examples/wordplay/.meteor/.finished-upgraders +++ b/examples/wordplay/.meteor/.finished-upgraders @@ -4,3 +4,4 @@ notices-for-0.9.0 notices-for-0.9.1 +0.9.4-platform-file diff --git a/examples/wordplay/.meteor/platforms b/examples/wordplay/.meteor/platforms new file mode 100644 index 0000000000..efeba1b50c --- /dev/null +++ b/examples/wordplay/.meteor/platforms @@ -0,0 +1,2 @@ +server +browser diff --git a/examples/wordplay/.meteor/release b/examples/wordplay/.meteor/release index 7b32bf7a26..7057f80807 100644 --- a/examples/wordplay/.meteor/release +++ b/examples/wordplay/.meteor/release @@ -1 +1 @@ -METEOR@0.9.3 +METEOR@0.9.4 diff --git a/examples/wordplay/.meteor/versions b/examples/wordplay/.meteor/versions index 3ba5d81ee5..5a899d9f06 100644 --- a/examples/wordplay/.meteor/versions +++ b/examples/wordplay/.meteor/versions @@ -1,51 +1,51 @@ -application-configuration@1.0.2 -autoupdate@1.1.1 -base64@1.0.0 -binary-heap@1.0.0 -blaze-tools@1.0.0 -blaze@2.0.1 -boilerplate-generator@1.0.0 -callback-hook@1.0.0 -check@1.0.1 -ctl-helper@1.0.3 -ctl@1.0.1 -ddp@1.0.9 -deps@1.0.4 -ejson@1.0.3 -fastclick@1.0.0 -follower-livedata@1.0.1 -geojson-utils@1.0.0 -html-tools@1.0.1 -htmljs@1.0.1 -http@1.0.6 -id-map@1.0.0 -insecure@1.0.0 -jquery@1.0.0 -json@1.0.0 -livedata@1.0.10 -logging@1.0.3 -meteor-platform@1.1.1 -meteor@1.1.1 -minifiers@1.1.0 -minimongo@1.0.3 -mobile-status-bar@1.0.0 -mongo@1.0.6 -observe-sequence@1.0.2 -ordered-dict@1.0.0 -random@1.0.0 -reactive-dict@1.0.3 -reactive-var@1.0.2 -reload@1.1.0 -retry@1.0.0 -routepolicy@1.0.1 -session@1.0.2 -spacebars-compiler@1.0.2 -spacebars@1.0.2 -standard-app-packages@1.0.2 -templating@1.0.7 -tracker@1.0.2 -ui@1.0.3 -underscore@1.0.0 -url@1.0.0 -webapp-hashing@1.0.0 -webapp@1.1.2 +application-configuration@1.0.3 +autoupdate@1.1.2 +base64@1.0.1 +binary-heap@1.0.1 +blaze-tools@1.0.1 +blaze@2.0.2 +boilerplate-generator@1.0.1 +callback-hook@1.0.1 +check@1.0.2 +ctl-helper@1.0.4 +ctl@1.0.2 +ddp@1.0.10 +deps@1.0.5 +ejson@1.0.4 +fastclick@1.0.1 +follower-livedata@1.0.2 +geojson-utils@1.0.1 +html-tools@1.0.2 +htmljs@1.0.2 +http@1.0.7 +id-map@1.0.1 +insecure@1.0.1 +jquery@1.0.1 +json@1.0.1 +livedata@1.0.11 +logging@1.0.4 +meteor-platform@1.1.2 +meteor@1.1.2 +minifiers@1.1.1 +minimongo@1.0.4 +mobile-status-bar@1.0.1 +mongo@1.0.7 +observe-sequence@1.0.3 +ordered-dict@1.0.1 +random@1.0.1 +reactive-dict@1.0.4 +reactive-var@1.0.3 +reload@1.1.1 +retry@1.0.1 +routepolicy@1.0.2 +session@1.0.3 +spacebars-compiler@1.0.3 +spacebars@1.0.3 +standard-app-packages@1.0.3 +templating@1.0.8 +tracker@1.0.3 +ui@1.0.4 +underscore@1.0.1 +url@1.0.1 +webapp-hashing@1.0.1 +webapp@1.1.3 diff --git a/examples/wordplay/client/wordplay.js b/examples/wordplay/client/wordplay.js index 3c4d816e6c..9e3059ffab 100644 --- a/examples/wordplay/client/wordplay.js +++ b/examples/wordplay/client/wordplay.js @@ -228,7 +228,7 @@ Meteor.startup(function () { // subscribe to all the players, the game i'm in, and all // the words in that game. - Deps.autorun(function () { + Tracker.autorun(function () { Meteor.subscribe('players'); if (Session.get('player_id')) { diff --git a/meteor b/meteor index ea3d18db07..f906b52695 100755 --- a/meteor +++ b/meteor @@ -1,6 +1,6 @@ #!/bin/bash -BUNDLE_VERSION=0.3.58 +BUNDLE_VERSION=0.3.59 # OS Check. Put here because here is where we download the precompiled # bundles that are arch specific. diff --git a/packages/accounts-base/package.js b/packages/accounts-base/package.js index 075cbd4073..a370823a77 100644 --- a/packages/accounts-base/package.js +++ b/packages/accounts-base/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "A user account system", - version: "1.1.2-pre.2" + version: "1.1.2" }); Package.on_use(function (api) { diff --git a/packages/accounts-base/url_client.js b/packages/accounts-base/url_client.js index 342acf8c02..202784f15a 100644 --- a/packages/accounts-base/url_client.js +++ b/packages/accounts-base/url_client.js @@ -80,6 +80,7 @@ AccountsTest = { * 2. `done`: A function to call when the password reset UI flow is complete. The normal * login process is suspended until this function is called, so that the * password for user A can be reset even if user B was logged in. + * @locus Client */ Accounts.onResetPasswordLink = function (callback) { if (accountsCallbacks["reset-password"]) { @@ -104,6 +105,7 @@ Accounts.onResetPasswordLink = function (callback) { * The normal login process is suspended until this function is called, so * that the user can be notified that they are verifying their email before * being logged in. + * @locus Client */ Accounts.onEmailVerificationLink = function (callback) { if (accountsCallbacks["verify-email"]) { @@ -128,6 +130,7 @@ Accounts.onEmailVerificationLink = function (callback) { * 2. `done`: A function to call when the enrollment UI flow is complete. * The normal login process is suspended until this function is called, so that * user A can be enrolled even if user B was logged in. + * @locus Client */ Accounts.onEnrollmentLink = function (callback) { if (accountsCallbacks["enroll-account"]) { diff --git a/packages/accounts-facebook/package.js b/packages/accounts-facebook/package.js index 199d549fef..36b7f64329 100644 --- a/packages/accounts-facebook/package.js +++ b/packages/accounts-facebook/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Login service for Facebook accounts", - version: "1.0.2-pre.2" + version: "1.0.2" }); Package.on_use(function(api) { diff --git a/packages/accounts-github/package.js b/packages/accounts-github/package.js index 8cc35421d9..9e30f5d8fc 100644 --- a/packages/accounts-github/package.js +++ b/packages/accounts-github/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Login service for Github accounts", - version: "1.0.2-pre.2" + version: "1.0.2" }); Package.on_use(function(api) { diff --git a/packages/accounts-google/package.js b/packages/accounts-google/package.js index 31d43632fc..8515ef8034 100644 --- a/packages/accounts-google/package.js +++ b/packages/accounts-google/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Login service for Google accounts", - version: "1.0.2-pre.2" + version: "1.0.2" }); Package.on_use(function(api) { diff --git a/packages/accounts-meetup/package.js b/packages/accounts-meetup/package.js index 01e55d1347..aa42b462cd 100644 --- a/packages/accounts-meetup/package.js +++ b/packages/accounts-meetup/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Login service for Meetup accounts", - version: "1.0.2-pre.2" + version: "1.0.2" }); Package.on_use(function(api) { diff --git a/packages/accounts-meteor-developer/package.js b/packages/accounts-meteor-developer/package.js index 81a56fcafc..2d16f72e6d 100644 --- a/packages/accounts-meteor-developer/package.js +++ b/packages/accounts-meteor-developer/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Login service for Meteor developer accounts", - version: "1.0.2-pre.2" + version: "1.0.2" }); Package.on_use(function (api) { diff --git a/packages/accounts-oauth/package.js b/packages/accounts-oauth/package.js index 361bc39ff0..7e98bbfc27 100644 --- a/packages/accounts-oauth/package.js +++ b/packages/accounts-oauth/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Common code for OAuth-based login services", - version: "1.1.2-pre.2" + version: "1.1.2" }); Package.on_use(function (api) { diff --git a/packages/accounts-password/email_templates.js b/packages/accounts-password/email_templates.js index a957e6fa24..bbc81036be 100644 --- a/packages/accounts-password/email_templates.js +++ b/packages/accounts-password/email_templates.js @@ -1,6 +1,6 @@ /** * @summary Options to customize emails sent from the Accounts system. - * @locus Anywhere + * @locus Server */ Accounts.emailTemplates = { from: "Meteor Accounts ", diff --git a/packages/accounts-password/package.js b/packages/accounts-password/package.js index 52084aa5b9..25c2bb9117 100644 --- a/packages/accounts-password/package.js +++ b/packages/accounts-password/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Password support for accounts", - version: "1.0.3-pre.2" + version: "1.0.3" }); Package.on_use(function(api) { diff --git a/packages/accounts-twitter/package.js b/packages/accounts-twitter/package.js index 46058c0f1e..e065f789c6 100644 --- a/packages/accounts-twitter/package.js +++ b/packages/accounts-twitter/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Login service for Twitter accounts", - version: "1.0.2-pre.2" + version: "1.0.2" }); Package.on_use(function(api) { diff --git a/packages/accounts-ui-unstyled/accounts_ui.js b/packages/accounts-ui-unstyled/accounts_ui.js index 17c697b946..c99eb87b6c 100644 --- a/packages/accounts-ui-unstyled/accounts_ui.js +++ b/packages/accounts-ui-unstyled/accounts_ui.js @@ -19,7 +19,7 @@ Accounts.ui._options = { * @param {Object} options * @param {Object} options.requestPermissions Which [permissions](#requestpermissions) to request from the user for each external service. * @param {Object} options.requestOfflineToken To ask the user for permission to act on their behalf when offline, map the relevant external service to `true`. Currently only supported with Google. See [Meteor.loginWithExternalService](#meteor_loginwithexternalservice) for more details. - * @param {Boolean} options.forceApprovalPrompt If true, forces the user to approve the app's permissions, even if previously approved. Currently only supported with Google. + * @param {Object} options.forceApprovalPrompt If true, forces the user to approve the app's permissions, even if previously approved. Currently only supported with Google. * @param {String} options.passwordSignupFields Which fields to display in the user creation form. One of '`USERNAME_AND_EMAIL`', '`USERNAME_AND_OPTIONAL_EMAIL`', '`USERNAME_ONLY`', or '`EMAIL_ONLY`' (default). */ Accounts.ui.config = function(options) { diff --git a/packages/accounts-ui-unstyled/package.js b/packages/accounts-ui-unstyled/package.js index 77fd534b07..aef2611535 100644 --- a/packages/accounts-ui-unstyled/package.js +++ b/packages/accounts-ui-unstyled/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Unstyled version of login widgets", - version: "1.1.3-pre.2" + version: "1.1.3" }); Package.on_use(function (api) { diff --git a/packages/accounts-ui/package.js b/packages/accounts-ui/package.js index efb4b3edb4..9fd88c1e08 100644 --- a/packages/accounts-ui/package.js +++ b/packages/accounts-ui/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Simple templates to add login widgets to an app", - version: "1.1.2-pre.2" + version: "1.1.2" }); Package.on_use(function (api) { diff --git a/packages/accounts-weibo/package.js b/packages/accounts-weibo/package.js index e4f2598eeb..fa3bd324f9 100644 --- a/packages/accounts-weibo/package.js +++ b/packages/accounts-weibo/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Login service for Sina Weibo accounts", - version: "1.0.2-pre.2" + version: "1.0.2" }); Package.on_use(function(api) { diff --git a/docs/client/packages/appcache.html b/packages/appcache/README.md similarity index 88% rename from docs/client/packages/appcache.html rename to packages/appcache/README.md index 58c0696662..63124ded13 100644 --- a/docs/client/packages/appcache.html +++ b/packages/appcache/README.md @@ -1,12 +1,11 @@ - diff --git a/packages/appcache/appcache-client.js b/packages/appcache/appcache-client.js index 1b7297d3aa..bc26714c45 100644 --- a/packages/appcache/appcache-client.js +++ b/packages/appcache/appcache-client.js @@ -13,7 +13,7 @@ var updatingAppcache = false; var reloadRetry = null; var appcacheUpdated = false; -Reload._onMigrate('appcache', function(retry) { +Reload._onMigrate('appcache', function (retry) { if (appcacheUpdated) return [true]; @@ -40,7 +40,7 @@ Reload._onMigrate('appcache', function(retry) { // If we're migrating and the app cache is now up to date, signal that // we're now ready to migrate. -var cacheIsNowUpToDate = function() { +var cacheIsNowUpToDate = function () { if (!updatingAppcache) return; appcacheUpdated = true; @@ -55,7 +55,7 @@ window.applicationCache.addEventListener('noupdate', cacheIsNowUpToDate, false); // cache has now been disabled or the appcache package removed. // Reload to get the new non-cached code. -window.applicationCache.addEventListener('obsolete', (function() { +window.applicationCache.addEventListener('obsolete', (function () { if (reloadRetry) { cacheIsNowUpToDate(); } else { diff --git a/packages/appcache/appcache-server.js b/packages/appcache/appcache-server.js index 4d26d2ebce..0323298df3 100644 --- a/packages/appcache/appcache-server.js +++ b/packages/appcache/appcache-server.js @@ -2,8 +2,10 @@ var crypto = Npm.require('crypto'); var fs = Npm.require('fs'); var path = Npm.require('path'); +var _disableSizeCheck = false; + Meteor.AppCache = { - config: function(options) { + config: function (options) { _.each(options, function (value, option) { if (option === 'browsers') { disabledBrowsers = {}; @@ -16,6 +18,10 @@ Meteor.AppCache = { RoutePolicy.declare(urlPrefix, 'static-online'); }); } + // option to suppress warnings for tests. + else if (option === '_disableSizeCheck') { + _disableSizeCheck = value; + } else if (value === false) { disabledBrowsers[option] = true; } @@ -29,7 +35,7 @@ Meteor.AppCache = { }; var disabledBrowsers = {}; -var browserDisabled = function(request) { +var browserDisabled = function (request) { return disabledBrowsers[request.browser.name]; }; @@ -40,7 +46,7 @@ WebApp.addHtmlAttributeHook(function (request) { return { manifest: "/app.manifest" }; }); -WebApp.connectHandlers.use(function(req, res, next) { +WebApp.connectHandlers.use(function (req, res, next) { if (req.url !== '/app.manifest') { return next(); } @@ -71,7 +77,7 @@ WebApp.connectHandlers.use(function(req, res, next) { // So to ensure that the client updates if client resources change, // include a hash of client resources in the manifest. - manifest += "# " + WebApp.clientHash + "\n"; + manifest += "# " + WebApp.clientHash() + "\n"; // When using the autoupdate package, also include // AUTOUPDATE_VERSION. Otherwise the client will get into an @@ -81,7 +87,7 @@ WebApp.connectHandlers.use(function(req, res, next) { if (Package.autoupdate) { var version = Package.autoupdate.Autoupdate.autoupdateVersion; - if (version !== WebApp.clientHash) + if (version !== WebApp.clientHash()) manifest += "# " + version + "\n"; } @@ -152,7 +158,7 @@ WebApp.connectHandlers.use(function(req, res, next) { return res.end(body); }); -var sizeCheck = function() { +var sizeCheck = function () { var totalSize = 0; _.each(WebApp.clientPrograms[WebApp.defaultArch].manifest, function (resource) { if (resource.where === 'client' && @@ -173,4 +179,12 @@ var sizeCheck = function() { } }; -sizeCheck(); +// Run the size check after user code has had a chance to run. That way, +// the size check can take into account files that the user does not +// want cached. Otherwise, the size check warning will still print even +// if the user excludes their large files with +// `Meteor.AppCache.config({onlineOnly: files})`. +Meteor.startup(function () { + if (! _disableSizeCheck) + sizeCheck(); +}); diff --git a/packages/appcache/appcache_tests-client.js b/packages/appcache/appcache_tests-client.js new file mode 100644 index 0000000000..fe3e6a25c1 --- /dev/null +++ b/packages/appcache/appcache_tests-client.js @@ -0,0 +1,143 @@ +var manifestUrl = '/app.manifest'; + +var appcacheTest = function (name, cb) { + Tinytest.addAsync('appcache - ' + name, function (test, next) { + HTTP.get(manifestUrl, function (err, res) { + if (err) { + test.fail(err); + } else { + cb(test, res); + } + next(); + }); + }); +}; + + +// Verify that the code status of the HTTP response is "OK" +appcacheTest('presence', function (test, manifest) { + test.equal(manifest.statusCode, 200, 'manifest not served'); +}); + + +// Verify the content-type HTTP header +appcacheTest('content type', function (test, manifest) { + test.equal(manifest.headers['content-type'], 'text/cache-manifest'); +}); + + +// Verify that each section header is only set once. +appcacheTest('sections uniqueness', function (test, manifest) { + var content = manifest.content; + var mandatorySectionHeaders = ['CACHE:', 'NETWORK:', 'FALLBACK:']; + var optionalSectionHeaders = ['SETTINGS']; + _.each(_.union(mandatorySectionHeaders, optionalSectionHeaders), + function (sectionHeader) { + var globalSearch = new RegExp(sectionHeader, "g"); + var matches = content.match(globalSearch) || []; + test.isTrue(matches.length <= 1, sectionHeader + ' is set twice'); + if (_.contains(mandatorySectionHeaders, sectionHeader)) { + test.isTrue(matches.length == 1, sectionHeader + ' is not set'); + } + }); +}); + + +// Verify the content of the header and of each section of the manifest using +// regular expressions. Regular expressions matches malformed URIs but that's +// not what we're trying to catch here (the user is free to add its own content +// in the manifest -- even malformed). +appcacheTest('sections validity', function (test, manifest) { + var lines = manifest.content.split('\n'); + var i = 0; + var currentRegex = null, line = null; + + var nextLine = function () { + return lines[i++]; + }; + + var eof = function () { + return i >= lines.length; + }; + + var nextLineMatches = function (expected, n) { + n = n || 1; + _.times(n, function () { + var testFunc = _.isRegExp(expected) ? 'matches' : 'equal'; + test[testFunc](nextLine(), expected); + }); + }; + + // Verify header validity + nextLineMatches('CACHE MANIFEST'); + nextLineMatches(''); + nextLineMatches(/^# [a-z0-9]+$/i, 2); + + + // Verify body validity + while (! eof()) { + line = nextLine(); + + // There are three distinct sections: 'CACHE', 'FALLBACK', and 'NETWORK'. + // A section start with its name suffixed by a colon. When we read a new + // section header, we update the currentRegex expression for the next lines + // of the section. + // XXX There is also a 'SETTINGS' section, not used by this package. If this + // section is used, the test will fail. + if (line === 'CACHE:' || line === 'NETWORK:') + currentRegex = /^\S+$/; + + else if (line === 'FALLBACK:') + currentRegex = /^\S+ \S+$/; + + // Blank lines and lines starting with a `#` (comments) are valid + else if (line == '' || line.match(/^#.+/)) + continue; + + // Outside sections, only blanks lines and comments are valid + else if (currentRegex === null) + test.fail('Invalid line ' + i + ': ' + line); + + // Inside a section, a star is a valid expression + else if (line === '*') + continue; + + // If it is not a blank line, not a comment, and not a header it must + // match the current section format + else + test.matches(line, currentRegex, 'line ' + i); + } +}); + + +// Verify that resources declared on the server with the `onlineOnly` parameter +// are present in the network section of the manifest. The `appcache` package +// also automatically add the manifest (`app.manifest`) add the star symbol to +// this list and therefore we also check the presence of these two elements. +appcacheTest('network section content', function (test, manifest) { + var shouldBePresentInNetworkSection = [ + "/app.manifest", + "/online/", + "/bigimage.jpg", + "/largedata.json", + "*" + ]; + var lines = manifest.content.split('\n'); + var startNetworkSection = lines.indexOf('NETWORK:'); + + // We search the end of the 'NETWORK:' section by looking at the beginning + // of any potential other section. By default we set this value to + // `lines.length - 1` which is the index of the last line. + var otherSections = ['CACHE:', 'FALLBACK:', 'SETTINGS']; + var endNetworkSection = _.reduce(otherSections, function (min, sectionName) { + var position = lines.indexOf(sectionName); + return position > startNetworkSection && position < min ? position : min; + }, lines.length - 1); + + // We remove the first line because it's the 'NETWORK:' header line. + var networkLines = lines.slice(startNetworkSection + 1, endNetworkSection); + + _.each(shouldBePresentInNetworkSection, function (item) { + test.include(networkLines, item); + }); +}); diff --git a/packages/appcache/appcache_tests-server.js b/packages/appcache/appcache_tests-server.js new file mode 100644 index 0000000000..ffcf1e0994 --- /dev/null +++ b/packages/appcache/appcache_tests-server.js @@ -0,0 +1,24 @@ +// For our testing purpose, we don't want the cache manifest to be +// active, all we want is the cache manifest to be manually request-able +// so we can read it and verify its validity from the client. This is +// because caching the test files would make tests non deterministic +// depending on the state of the browser cache. To do that we disable +// the "manifest" attribute of the tag. This runs after appcache +// registers its hook, so this hook overrides the return value of the +// real hook. We point to a non-existent file to clear the appcache in +// case there was previously a site running with appcache on +// localhost:3000. +WebApp.addHtmlAttributeHook(function (request) { + return { manifest: "/no-such-file" }; +}); + + +// Let's add some resources in the 'NETWORK' section +Meteor.AppCache.config({ + onlineOnly: [ + '/online/', + '/bigimage.jpg', + '/largedata.json' + ], + _disableSizeCheck: true // don't print warnings +}); diff --git a/packages/appcache/package.js b/packages/appcache/package.js index 4588b5d748..a5ee05a9b9 100644 --- a/packages/appcache/package.js +++ b/packages/appcache/package.js @@ -1,14 +1,24 @@ Package.describe({ summary: "Enable the application cache in the browser", - version: "1.0.2-pre.2" + version: "1.0.2" }); -Package.on_use(function (api) { +Package.onUse(function (api) { api.use('webapp', 'server'); api.use('reload', 'client'); api.use('routepolicy', 'server'); api.use('underscore', 'server'); api.use('autoupdate', 'server', {weak: true}); - api.add_files('appcache-client.js', 'client'); - api.add_files('appcache-server.js', 'server'); + api.addFiles('appcache-client.js', 'client'); + api.addFiles('appcache-server.js', 'server'); +}); + +Package.onTest(function (api) { + api.use('tinytest'); + api.use('appcache'); + api.use('http', 'client'); + api.use('underscore', 'client'); + api.use('webapp', 'server'); + api.addFiles('appcache_tests-server.js', 'server'); + api.addFiles('appcache_tests-client.js', 'client'); }); diff --git a/packages/application-configuration/package.js b/packages/application-configuration/package.js index ee128a5947..4e19ec152d 100644 --- a/packages/application-configuration/package.js +++ b/packages/application-configuration/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Interaction with the configuration sources for your apps", - version: '1.0.3-pre.2' + version: '1.0.3' }); Package.on_use(function (api) { diff --git a/packages/audit-argument-checks/package.js b/packages/audit-argument-checks/package.js index fc2063dcc1..336f8f9c00 100644 --- a/packages/audit-argument-checks/package.js +++ b/packages/audit-argument-checks/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Try to detect inadequate input sanitization", - version: '1.0.1-pre.2' + version: '1.0.1' }); // This package is empty; its presence is detected by livedata. diff --git a/packages/autopublish/package.js b/packages/autopublish/package.js index ad81034057..bece2d51d5 100644 --- a/packages/autopublish/package.js +++ b/packages/autopublish/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Publish the entire database to all clients", - version: '1.0.1-pre.2' + version: '1.0.1' }); // This package is empty; its presence is detected by livedata and diff --git a/packages/autoupdate/README.md b/packages/autoupdate/README.md new file mode 100644 index 0000000000..b1c634a92a --- /dev/null +++ b/packages/autoupdate/README.md @@ -0,0 +1,12 @@ +# autoupdate + +This package is the heart of Meteor's Hot Code Push functionality. It +has a client component and a server component component. The client +component uses a DDP API provided by the server to subscribe to the +version ID of the most recent build of the app's client. When it sees +that a new version is available, it uses the +[reload](https://atmospherejs.com/meteor/reload) package to gracefully +save the app's state and reload it in place. + +`autoupdate` is part of the [Webapp](https://www.meteor.com/webapp) +project. diff --git a/packages/autoupdate/autoupdate_cordova.js b/packages/autoupdate/autoupdate_cordova.js index 3cab024b6c..d8ab99b396 100644 --- a/packages/autoupdate/autoupdate_cordova.js +++ b/packages/autoupdate/autoupdate_cordova.js @@ -157,7 +157,7 @@ var onNewVersion = function () { log("Download error, will retry (#" + tries + "): " + uri); tryDownload(); } else { - log('Download failed: ' + err + ", source=" + err.source + ", target=" + err.target); + log('Download failed: ' + JSON.stringify(err) + ", source=" + err.source + ", target=" + err.target); } }); }; diff --git a/packages/autoupdate/autoupdate_server.js b/packages/autoupdate/autoupdate_server.js index bdbbae2233..8b99ba00ad 100644 --- a/packages/autoupdate/autoupdate_server.js +++ b/packages/autoupdate/autoupdate_server.js @@ -137,6 +137,11 @@ var updateVersions = function (shouldReloadClientProgram) { Meteor.publish( "meteor_autoupdate_clientVersions", function (appId) { + // `null` happens when a client doesn't have an appId and passes + // `undefined` to `Meteor.subscribe`. `undefined` is translated to + // `null` as JSON doesn't have `undefined. + check(appId, Match.OneOf(String, undefined, null)); + // Don't notify clients using wrong appId such as mobile apps built with a // different server but pointing at the same local url if (Autoupdate.appId && appId && Autoupdate.appId !== appId) diff --git a/packages/autoupdate/package.js b/packages/autoupdate/package.js index 20ba317d4e..994b07f9e4 100644 --- a/packages/autoupdate/package.js +++ b/packages/autoupdate/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Update the client when new client code is available", - version: '1.1.2-pre.4' + version: '1.1.2' }); Cordova.depends({ diff --git a/packages/base64/package.js b/packages/base64/package.js index b0a98152d3..a585469205 100644 --- a/packages/base64/package.js +++ b/packages/base64/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Base64 encoding and decoding", - version: '1.0.1-pre.2' + version: '1.0.1' }); Package.on_use(function (api) { diff --git a/packages/binary-heap/package.js b/packages/binary-heap/package.js index 8ef1341e26..ddd41ef19a 100644 --- a/packages/binary-heap/package.js +++ b/packages/binary-heap/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Binary Heap datastructure implementation", - version: '1.0.1-pre.2' + version: '1.0.1' }); Package.on_use(function (api) { diff --git a/packages/blaze-tools/package.js b/packages/blaze-tools/package.js index 9558acc125..615df9e8ae 100644 --- a/packages/blaze-tools/package.js +++ b/packages/blaze-tools/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Compile-time tools for Blaze", - version: '1.0.1-pre.2' + version: '1.0.1' }); Package.on_use(function (api) { diff --git a/packages/blaze/package.js b/packages/blaze/package.js index 2f622490a0..e39698c2e0 100644 --- a/packages/blaze/package.js +++ b/packages/blaze/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Meteor Reactive Templating library", - version: '2.0.2-pre.2' + version: '2.0.2' }); Package.on_use(function (api) { diff --git a/packages/blaze/preamble.js b/packages/blaze/preamble.js index 8229c20f3a..1928c72359 100644 --- a/packages/blaze/preamble.js +++ b/packages/blaze/preamble.js @@ -22,8 +22,8 @@ Blaze._escape = (function() { Blaze._warn = function (msg) { msg = 'Warning: ' + msg; - if ((typeof 'Log' !== 'undefined') && Log && Log.warn) + if ((typeof Log !== 'undefined') && Log && Log.warn) Log.warn(msg); // use Meteor's "logging" package - else if ((typeof 'console' !== 'undefined') && console.log) + else if ((typeof console !== 'undefined') && console.log) console.log(msg); }; diff --git a/packages/boilerplate-generator/package.js b/packages/boilerplate-generator/package.js index b92cdfc762..b0d75bc70d 100644 --- a/packages/boilerplate-generator/package.js +++ b/packages/boilerplate-generator/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Generates the boilerplate html from program's manifest", - version: '1.0.1-pre.4' + version: '1.0.1' }); Package.on_use(function (api) { diff --git a/packages/browser-policy-common/README.md b/packages/browser-policy-common/README.md new file mode 100644 index 0000000000..37f8a88562 --- /dev/null +++ b/packages/browser-policy-common/README.md @@ -0,0 +1,7 @@ +# browser-policy-common + +This is one of a family of packages that can be used to easily +configure an app's browser-side security policies. The documentation +is in the +[browser-policy](https://atmospherejs.com/meteor/browser-policy) +package. diff --git a/packages/browser-policy-common/package.js b/packages/browser-policy-common/package.js index 9eaeefa063..88d2bbc0d9 100644 --- a/packages/browser-policy-common/package.js +++ b/packages/browser-policy-common/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Common code for browser-policy packages", - version: "1.0.1-pre.2" + version: "1.0.1" }); Package.on_use(function (api) { diff --git a/packages/browser-policy-content/README.md b/packages/browser-policy-content/README.md new file mode 100644 index 0000000000..864b2f283f --- /dev/null +++ b/packages/browser-policy-content/README.md @@ -0,0 +1,7 @@ +# browser-policy-content + +This is one of a family of packages that can be used to easily +configure an app's browser-side security policies. The documentation +is in the +[browser-policy](https://atmospherejs.com/meteor/browser-policy) +package. diff --git a/packages/browser-policy-content/package.js b/packages/browser-policy-content/package.js index 27665431ac..f4cf825775 100644 --- a/packages/browser-policy-content/package.js +++ b/packages/browser-policy-content/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Configure content security policies", - version: "1.0.2-pre.2" + version: "1.0.2" }); Package.on_use(function (api) { diff --git a/packages/browser-policy-framing/README.md b/packages/browser-policy-framing/README.md new file mode 100644 index 0000000000..bdf41b0189 --- /dev/null +++ b/packages/browser-policy-framing/README.md @@ -0,0 +1,7 @@ +# browser-policy-framing + +This is one of a family of packages that can be used to easily +configure an app's browser-side security policies. The documentation +is in the +[browser-policy](https://atmospherejs.com/meteor/browser-policy) +package. diff --git a/packages/browser-policy-framing/package.js b/packages/browser-policy-framing/package.js index 801ec73397..ed66d69e33 100644 --- a/packages/browser-policy-framing/package.js +++ b/packages/browser-policy-framing/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Restrict which websites can frame your app", - version: "1.0.2-pre.2" + version: "1.0.2" }); Package.on_use(function (api) { diff --git a/docs/client/packages/browser-policy.html b/packages/browser-policy/README.md similarity index 62% rename from docs/client/packages/browser-policy.html rename to packages/browser-policy/README.md index 94c90a4616..ee24bcf696 100644 --- a/docs/client/packages/browser-policy.html +++ b/packages/browser-policy/README.md @@ -1,10 +1,10 @@ -