Skip to content

Atom meteor snippets with tab completion using es6 syntax

License

Notifications You must be signed in to change notification settings

erickeno/meteorjs-snippets-es6

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Meteor.js es6 Snippets

apm

Atom meteor snippets with tab completion using the latest es6 syntax

Preview

SNIPPETS

Imports

mimp

import { Meteor } from 'meteor/meteor';

mimg

import { Mongo } from 'meteor/mongo';

mival

import { ValidatedMethod } from 'meteor/mdg:validated-method';

mich

import { check } from 'meteor/check';

Collection Snippets

cola

Collection.allow({
  insert() { return false; },
  update() { return false; },
  remove() { return false; },
});

colde

Collection.deny({
  insert() { return true; },
  update() { return true; },
  remove() { return true; },
});

mcol

export const Collection = new Mongo.Collection("collection")

mfind

Collection.find({ _id:... });

mfone

Collection.findOne(...);

Meteor Publish

mpub

Meteor.publish("name", function(argument){
  ...
});

Meteor Subscribe

msub

Meteor.subscribe("name", arguments);

Meteor Methods

mmeth

Meteor.methods({
  "name" (arguments) {
    ...
  },
});

mvmeth

export const name = new ValidatedMethod({
  name: "...",
  validate: new SimpleSchema({
    ...  
  }).validator(),
  run(arguments) {
    ...  
  }
});

Meteor Call

mcall

Meteor.call(name, args (err, res) => {
  if(er) {
    ...
  } else {
    ...  
  }
});

Meteor Apply

mapp

meteor.apply(name, args, (err, res) => {
  if(err) {
    ...
  } else {
    ...  
  }
});

Blaze js Template snippets

mhel

Template.name.helpers({
  helper(args) {
    ...
  },
});

mev

Template.name.events({
  event(event,instance) {
    ...
  },
});

mren

Template.name.onRendered(function() {
  ...
});

mcre

Template.name.onCreated(function() {
  ...
});

mdes

Template.name.onDestroyed(function() {
  ...
});

Blaze template snippets

mtp

<template name="name">
  ...
</template>

mif

{{#if statement}}
  ...
{{/if}}

mife

{{#if statement}}
  ...
{{else}}
  ...
{{/if}}

mei

{{#each value in collection}}
  ...
{{/each}}

mlet

{{#let variable=helper}}
  ...
{{/let}}

Inspired by meteor-snippets.

MIT License

Copyright (c) 2016 erick B

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.