没有拿起我的插件:无法读取未定义的属性'text2Speech'

时间:2015-05-26 22:56:00

标签: javascript jquery-plugins

(function($){
   $.fn.myLib = function (global) {

     global.text2Speech = {
       getSpeaker: function (lang, maxWordsPerPhrase) {
         var spkr = Object.create(speaker);
         spkr.lang = lang || 'en';
         // TODO: do a proper checking
         // this won't prevent a non number to be assigned here
         if (maxWordsPerPhrase) {
           spkr.maxWordsPerPhrase = maxWordsPerPhrase;
         }
         if (!sayIt) {
           createSayIt();
         }

         return speaker;
       }
     };
   }
 }(jQuery));


 $(function() {

      var t2s = window.myLib.text2Speech;
      // console.log(t2s);
      var spkr = t2s.getSpeaker('en', 16);

  });

我得到Uncaught TypeError:无法读取未定义的属性'text2Speech'。我做错了什么?

0 个答案:

没有答案