Một hoặc nhiều ánh xạ từ loại MIME đến mô-đun Native Client xử lý từng loại. Ví dụ: mã in đậm trong đoạn mã sau đây đăng ký mô-đun Native Client làm trình xử lý nội dung cho loại MIME bảng tính OpenOffice.
{
"name": "Native Client OpenOffice Spreadsheet Viewer",
"version": "0.1",
"description": "Open OpenOffice spreadsheets, right in your browser.",
"nacl_modules": [{
"path": "OpenOfficeViewer.nmf",
"mime_type": "application/vnd.oasis.opendocument.spreadsheet"
}]
}
Giá trị của "path" là vị trí của tệp kê khai Native Client (tệp .nmf
) trong thư mục tiện ích. Để biết thêm thông tin về tệp Native Client và tệp .nmf
, hãy xem Tổng quan về kỹ thuật của Native Client.
Mỗi loại MIME chỉ có thể liên kết với một tệp .nmf
, nhưng một tệp .nmf
có thể xử lý nhiều loại MIME. Ví dụ sau đây cho thấy một tiện ích có 2 tệp .nmf
xử lý 3 loại MIME.
{
"name": "Spreadsheet Viewer",
"version": "0.1",
"description": "Open OpenOffice and Excel spreadsheets, right in your browser.",
"nacl_modules": [{
"path": "OpenOfficeViewer.nmf",
"mime_type": "application/vnd.oasis.opendocument.spreadsheet"
},
{
"path": "OpenOfficeViewer.nmf",
"mime_type": "application/vnd.oasis.opendocument.spreadsheet-template"
},
{
"path": "ExcelViewer.nmf",
"mime_type": "application/excel"
}]
}