0
我想將一些僅客戶端代碼分割成Derby.js項目中的幾個文件。由於它與TinyMCE編輯器交互,因此它必須是客戶端。所以,我想:Derby.js:將客戶端唯一代碼分割成幾個文件
app.ready(function(model) {
var tiny = derby.use(require('../../lib/app/TinyMCE'))
//other client-side code
}
,並把下列lib/app/TinyMCE.js
:
var derby = require('derby')
module.exports.decorate = 'derby'; //because before I got an 'decorate' is undefined error...
module.exports.TinyMCE = function() {
//code
}
但現在我得到一個object is not a function
錯誤。
我是否在正確的軌道?我也考慮過把代碼放在公共目錄中,但是一年的緩存到期會讓這很不方便。
另外,是否真的沒有isServer
或isClient
方法來查詢?