我打算做的是有一個單獨的文件夾,其中將包含'服務'。這將用於調用各種REST API。以下是我正在考慮使用的模式。這是否打破了NativeScript的任何慣例,或者它甚至是好的做法?該服務可以從應用程序內的其他文件夾調用,所以我試圖讓事情乾燥。如何支持NativeScript服務
app.js // The main app file, loads /items/items_list/items_list.xml
as first screen of the app.
/services
/parts
get_parts.js // Lets say this would be a http service, called from
either /items or /jobs, or even anywhere else
within the app.
/items
/items_list
item_list.css
item_list.xml
item_list.js
...
/jobs
/jobs_list
jobs_list.css
jobs_list.xml
jobs_list.js
...
名稱是爲了這個問題的目的而編寫的,所以希望它仍然有意義。
選擇此作爲答案。 StephenFeather表示,我的問題可能有些模糊。這是我正在尋找的答案。我訪問過這個鏈接,並確認我正在爲NativeScript項目找到正確的路線。感謝你們的投入。 – Wittner