मैं क्लोजर कंपाइलर के साथ काम करने के लिए पिक्ज लाइब्रेरी के लिए बाहरी फ़ाइल तैयार कर रहा हूं। एकमात्र समस्या जो मैं अब तक कर रहा हूं वह कस्टम ऑब्जेक्ट पैरामीटर के साथ है।PIXI.js के लिए क्लोजर कंपाइलर EXTERNS - कस्टम ऑब्जेक्ट पैरामीटर एनोटेशन
pixi.js स्रोत:
/**
* Set the style of the text
*
* @param [style] {object} The style parameters
* @param [style.font='bold 20pt Arial'] {string} The style and size of the font
* @param [style.fill='black'] {string|number} A canvas fillstyle that will be used on the text eg 'red', '#00FF00'
* @param [style.align='left'] {string} Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text
बंद संकलक उत्पादन: यहाँ एक छोटी उदाहरण है
lib/pixi-externs.js:3266: WARNING - Parse error. invalid param name "style.font"
* @param [style.font='bold 20pt Arial'] {string} The style and size of the font
^
lib/pixi-externs.js:3266: WARNING - Bad type annotation. missing closing ]
* @param [style.font='bold 20pt Arial'] {string} The style and size of the font
^
lib/pixi-externs.js:3267: WARNING - Parse error. invalid param name "style.fill"
* @param [style.fill='black'] {string|number} A canvas fillstyle that will be used on the text eg 'red', '#00FF00'
^
lib/pixi-externs.js:3268: WARNING - Parse error. invalid param name "style.align"
* @param [style.align='left'] {string} Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text
^
कैसे इन pixijs एनोटेशन बंद संकलक एनोटेशन अनुकूलित किया जा सकता?
यदि एनोटेशन के माध्यम से इसे प्राप्त करने का कोई तरीका नहीं है, तो क्या मैं इसे एक नई वस्तु को परिभाषित करके दूर कर सकता हूं?
* @param {PIXI.TextStyleObject} style The style parameters
और इस तरह एक अलग TextStyleObject ऑब्जेक्ट परिभाषा बनाना?
PIXI.TextStyleObject = {};
PIXI.TextStyleObject.font;
PIXI.TextStyleObject.fill;
PIXI.TextStyleObject.align;
इस समस्या को हल करने का सही तरीका क्या है?
यह बढ़िया है। आपके सहयोग के लिए धन्यवाद। –
क्या डिफ़ॉल्ट मान निर्दिष्ट करने का कोई तरीका है, जैसे पिक्सी में है: [style.fill = 'black']? –
नहीं। यह केवल प्रकार की जानकारी के लिए है। इसका वास्तविक कोड निष्पादन पर कोई असर नहीं है। –