2016-02-24 53 views
0

我目前正在研究cordova/phonegap,我已經安裝了來自'https://www.npmjs.com/package/cordova-plugin-refresh-gallery'的refreshgallary插件,但我沒有在'window'對象中找到它,每次都似乎沒有定義。 下插件WWW文件夾pluginRefresgGallary.js文件代碼看起來像下面(代碼被改變): -插件似乎是在科爾多瓦未定義..!

cordova.define("Plugins/RefreshGalleryPlugin/", function (require, exports, module) { 

var exec = require('cordova/exec'); 
// Plugin Refresh Gallery - Android 

var RefreshMedia = function() { 
}; 

RefreshMedia.prototype.refresh = function(url) { 
    exec(success, error, "PluginRefreshGallery", "refresh", [url]); 
}; 

var success = function(success){ 
    //alert("Success"); 
}, 

error = function(error){ 
    //alert("Error"); 
}; 

window.refreshMedia = new RefreshMedia(); 
module.exports = refreshMedia; 
}) 

此我是越來越稱爲模塊錯誤之前沒有定義,並且我想上面的代碼錯誤定義的模塊解決了,但我沒有得到refreshGallry插入Windows對象。

任何人都可以幫助我解決這個問題?

回答

0

這個錯誤有時在調試時發生,只是不在乎。

正如我在插件文檔中看到的,它不適用於窗口對象。只需將它稱爲refreshMedia到您的JavaScript。

+0

嗨,感謝您的幫助,但是當我直接調用它似乎是未定義的。 –

+0

是否有任何代碼來刷新文件管理器路徑? –

相關問題