Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep Getting Use Require Error #44

Open
patvin80 opened this issue Jun 20, 2016 · 0 comments
Open

Keep Getting Use Require Error #44

patvin80 opened this issue Jun 20, 2016 · 0 comments

Comments

@patvin80
Copy link

patvin80 commented Jun 20, 2016

Module name "twitter-node-client" has not been loaded yet for context: _. Use require([])

I am trying to use this in a Office 365 Addin and followed the instructions.

(function(){
  'use strict';

  // The Office initialize function must be run each time a new page is loaded
  Office.initialize = function(reason){
    jQuery(document).ready(function(){
      app.initialize();

      displayItemDetails();
    });
  };

  // Displays the "Subject" and "From" fields, based on the current mail item
  function displayItemDetails(){
    var item = Office.cast.item.toItemRead(Office.context.mailbox.item);
    jQuery('#subject').text(item.subject);

    var from;
    if (item.itemType === Office.MailboxEnums.ItemType.Message) {
      from = Office.cast.item.toMessageRead(item).from;
    } else if (item.itemType === Office.MailboxEnums.ItemType.Appointment) {
      from = Office.cast.item.toAppointmentRead(item).organizer;
    }

    if (from) {
      jQuery('#from').text(from.displayName);
      jQuery('#from').click(function(){
        app.showNotification(from.displayName, from.emailAddress);
      });
    }
     debugger;
      //Callback functions 
    var error = function (err, response, body) {
        console.log('ERROR [%s]', err);
    };
    var success = function (data) {
        console.log('Data [%s]', data);
    };

    var Twitter = require('twitter-node-client').Twitter;

    //Get this data from your twitter apps dashboard 
    var config = {
        "consumerKey": "z3qgwIah7X8dWA8O2ktwqQ",
        "consumerSecret": "j8f3g03UImTrl2wb0aUvS7Qj062PmHGHNoBix1VmYgYm",
        "accessToken": "18077593-47K5rni1FLI9DmHlKEIW9tYSPHCaWpGNZ8U",
        "accessTokenSecret": "EohjUdkNWx4fHcNYlklKYnTu5j0rNY3VAnmjLIq "
    }

    var twitter = new Twitter(config);

      twitter.getSearch({'q':'#haiku','count': 10}, error, success);
      twitter.getSearch({'q':'#haiku','count': 10}, error, success);
  }
})();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant