Commit 731ac9df by Sebastián Katzer

Only register permission once

parent a1f7d250
...@@ -414,6 +414,13 @@ exports.hasPermission = function (callback, scope) { ...@@ -414,6 +414,13 @@ exports.hasPermission = function (callback, scope) {
* The callback function's scope * The callback function's scope
*/ */
exports.registerPermission = function (callback, scope) { exports.registerPermission = function (callback, scope) {
if (this._registered) {
return this.hasPermission(callback, scope);
} else {
this._registered = true;
}
var fn = this.createCallbackFn(callback, scope); var fn = this.createCallbackFn(callback, scope);
if (device.platform != 'iOS') { if (device.platform != 'iOS') {
......
...@@ -44,6 +44,9 @@ exports._defaults = { ...@@ -44,6 +44,9 @@ exports._defaults = {
// listener // listener
exports._listener = {}; exports._listener = {};
// Registered permission flag
exports._registered = false;
/******** /********
* UTIL * * UTIL *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment