Skip to content

Instantly share code, notes, and snippets.

@jpopesculian
Created March 16, 2016 23:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpopesculian/9a292961d4f6f3f9eab4 to your computer and use it in GitHub Desktop.
Save jpopesculian/9a292961d4f6f3f9eab4 to your computer and use it in GitHub Desktop.
<template name="example">
<button id="button">{{buttonName}}</button>
</template>
Template.example.helpers({
buttonName: function() {
return "Button";
}
});
Template.example.events({
'click #button': function(event, template) {
Meteor.call('exampleMethod', data, function(error, response) {
// do something with response
});
}
});
Template.example.onCreated(function () {
var ready = new ReactiveVar(false);
// load reactive vars in here
//
// reactive vars used in helper functions or Template.autorun
// functions get automatically reloaded on reactive var changes
});
Template.example.onRendered(function() {
// load external js in here probably
});
Package.describe({
name: 'example-package',
version: '0.0.1',
summary: 'example',
git: ''
});
Package.onUse(function(api) {
api.versionsFrom('1.0');
api.use([
'rocketchat:lib@0.0.1',
]);
api.use([
'templating'
], 'client');
Npm.depends({
'opentok': '2.3.0'
});
api.addFiles([
'server.js'
], 'server');
api.addFiles([
'client.html',
'client.js',
'tabBar.js'
], 'client');
});
var OpenTok = Npm.require('opentok'),
apiKey = "key",
apiSecret = "secret",
openTok = new OpenTok(apiKey, apiSecret);
Meteor.methods({
exampleMethod: function(data) {
syncMethod = Meteor.wrapAsync(openTok.method);
response = syncMethod(method);
return response;
}
})
Meteor.startup(function() {
var settings = {
i18nTitle: "Example",
icon: "icon-example",
id: "example",
template: "example",
order: 10,
};
return RocketChat.callbacks.add('enter-room', function() {
return RocketChat.TabBar.addButton(
settings,
RocketChat.callbacks.priority.MEDIUM,
'enter-room-tabbar-example'
);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment