i want to use a plugin in Firefox that it is in this . in this plugin tutorial use require
function, and it is: require("sdk/preferences/service");
but i get error that require is not defined
. so i search and download requireJS . but when attach this i get error module name sdk/preference/service has not been loaded yet from context. use require([])
module name sdk/preference/service has not been loaded yet from context. use require([])
.
so i use require(["sdk/preferences/service"],function(pref){});
but in function i can't use pref and get error script error sdk/preferences/service
so how can i use require function?
or a HTML example that use require function and it works correctly?
The code you found was for use in a Firefox extension. You're not writing a Firefox extension, you're using a web page, so you can't use that code. There's no drop-in replacement; you'll have to find something else.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.