figma-api-stub
Advanced tools
Comparing version 0.0.30 to 0.0.31
declare type TConfig = { | ||
simulateErrors?: boolean; | ||
isWithoutTimeout?: boolean; | ||
}; | ||
export declare const createFigma: (config: TConfig) => PluginAPI; | ||
export declare const createParentPostMessage: (figma: PluginAPI) => (message: { | ||
export declare const createParentPostMessage: (figma: PluginAPI, isWithoutTimeout?: boolean) => (message: { | ||
pluginMessage: any; | ||
}, target: string) => void; | ||
export {}; |
@@ -20,3 +20,4 @@ "use strict"; | ||
var defaultConfig = { | ||
simulateErrors: false | ||
simulateErrors: false, | ||
isWithoutTimeout: false | ||
}; | ||
@@ -49,6 +50,12 @@ var isInsideInstance = function (node) { | ||
if (global && global.onmessage) { | ||
setTimeout(function () { | ||
if (config.isWithoutTimeout) { | ||
// @ts-ignore | ||
global.onmessage(message); | ||
}, 0); | ||
} | ||
else { | ||
setTimeout(function () { | ||
// @ts-ignore | ||
global.onmessage(message); | ||
}, 0); | ||
} | ||
} | ||
@@ -412,10 +419,16 @@ }; | ||
}; | ||
exports.createParentPostMessage = function (figma) { return function (message, target) { | ||
exports.createParentPostMessage = function (figma, isWithoutTimeout) { return function (message, target) { | ||
if (figma.ui.onmessage) { | ||
setTimeout(function () { | ||
var call = function () { | ||
// @ts-ignore | ||
figma.ui.onmessage(message.pluginMessage, { origin: null }); | ||
}, 0); | ||
}; | ||
if (isWithoutTimeout) { | ||
call(); | ||
} | ||
else { | ||
setTimeout(call, 0); | ||
} | ||
} | ||
}; }; | ||
//# sourceMappingURL=stubs.js.map |
{ | ||
"name": "figma-api-stub", | ||
"version": "0.0.30", | ||
"version": "0.0.31", | ||
"description": "Figma API stub", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54997
1163