We've always been at war with {{theEnemy}}.
``` -------------------------------- ### Basic ReactiveDict Usage Source: https://github.com/meteor/docs/blob/master/source/api/reactive-dict.md Demonstrates setting and getting a value, and how changes trigger reactive updates via Tracker.autorun. ```javascript const state = new ReactiveDict(); state.set('currentRoomId', 'random'); Tracker.autorun(() => { Meteor.subscribe('chatHistory', { room: state.get('currentRoomId') }); }); // Causes the function passed to `Tracker.autorun` to be rerun, so that the // 'chatHistory' subscription is moved to the room 'general'. state.set('currentRoomId', 'general'); ``` -------------------------------- ### Basic Server-Side Rendering with React Source: https://github.com/meteor/docs/blob/master/source/packages/server-render.md Example of using `onPageLoad` on the server to render a React component into an element with id 'app' using `renderToString`. ```javascript import React from "react"; import { renderToString } from "react-dom/server"; import { onPageLoad } from "meteor/server-render"; import App from "/imports/Server.js"; onPageLoad(sink => { sink.renderIntoElementById("app", renderToString(
```
--------------------------------
### Example: Cleanup on Invalidation
Source: https://github.com/meteor/docs/blob/master/source/api/tracker.md
Demonstrates how to perform cleanup actions when a computation is invalidated or stopped using Tracker.onInvalidate.
```js
if (Tracker.active) {
Tracker.onInvalidate(() => {
x.destroy();
y.finalize();
});
}
```
--------------------------------
### Meteor Build Plugins API Overview
Source: https://github.com/meteor/docs/blob/master/source/api/packagejs.md
Provides an overview of the Meteor Build Plugins API, which integrates with the Isobuild tool for application compilation and bundling. It outlines the three phases: linting, compilation, and minification.
```APIDOC
Build Plugins API:
Phases:
- Linting: Checks code for undeclared variables or style guidelines.
- Compilation: Transforms source files (e.g., CoffeeScript, ES2015) into plain JavaScript and CSS.
- Minification: Optimizes JavaScript and CSS files, potentially including concatenation.
File Processing Methods:
- getContentsAsBuffer(): Returns file contents as a buffer.
- getContentsAsString(): Returns file contents as a string.
- getPackageName(): Returns the name of the package or null.
- getPathInPackage(): Returns the relative path of the file within the package or app root.
- getSourceHash(): Returns a hash string for caching.
- getArch(): Returns the targeted architecture.
- getBasename(): Returns the filename.
- getDirname(): Returns the directory path relative to the package or app root.
- error(message): Raises a compilation or linting error for the file.
```
--------------------------------
### Meteor Package and App Management
Source: https://github.com/meteor/docs/blob/master/source/commandline.md
Commands for linting, searching, showing information about packages, and testing local packages. Also includes commands for administrative tasks and interactive shells.
```bash
# Run linters and view build errors:
meteor lint
# Search for Meteor packages:
meteor search