Confirmed users
258
edits
| Line 115: | Line 115: | ||
==== Icc Object Life Cycle ==== | ==== Icc Object Life Cycle ==== | ||
Icc object only be created when corresponding icc is detected by system. And becomes invalid after | Icc object only be created when corresponding icc is detected by system. And becomes invalid after it can not be detected by system. | ||
* You can use IccManager to monitor this. | * You can use IccManager to monitor this. | ||
var iccManager = navigator.mozIccManager; | var iccManager = navigator.mozIccManager; | ||
| Line 129: | Line 129: | ||
} | } | ||
* If you already hold a reference for a specific icc object, you | * If you already hold a reference for a specific icc object, you can monitor this via cardState or iccInfo. | ||
var icc = iccManager.getIccById(iccId); | var icc = iccManager.getIccById(iccId); | ||
icc.oncardstatechange = function () { | icc.oncardstatechange = function () { | ||
if (icc.cardState === null) { | if (icc.cardState === null) { | ||
// System can not detect this icc any more, this icc object becomes | // System can not detect this icc any more, this icc object becomes invalid. | ||
} | } | ||
} | } | ||
| Line 140: | Line 140: | ||
icc.oniccinfochange = function () { | icc.oniccinfochange = function () { | ||
if (icc.iccInfo === null) { | if (icc.iccInfo === null) { | ||
// System can not detect this icc any more, this icc object becomes | // System can not detect this icc any more, this icc object becomes invalid. | ||
} | } | ||
} | } | ||