ember-primitives 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/iframe.js +34 -0
- package/dist/iframe.js.map +1 -0
- package/dist-types/iframe.d.ts +31 -0
- package/dist-types/iframe.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/iframe.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns true if the current frame is within an iframe.
|
|
3
|
+
*
|
|
4
|
+
* ```gjs
|
|
5
|
+
* import { inIframe } from 'ember-primitives/iframe';
|
|
6
|
+
*
|
|
7
|
+
* <template>
|
|
8
|
+
* {{#if (inFrame)}}
|
|
9
|
+
* only show content in an iframe
|
|
10
|
+
* {{/if}}
|
|
11
|
+
* </template>
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
const inIframe = () => window.self !== window.top;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Returns true if the current frame is not within an iframe.
|
|
18
|
+
*
|
|
19
|
+
* ```gjs
|
|
20
|
+
* import { notInIframe } from 'ember-primitives/iframe';
|
|
21
|
+
*
|
|
22
|
+
* <template>
|
|
23
|
+
* {{#if (notInIframe)}}
|
|
24
|
+
* only show content when not in an iframe
|
|
25
|
+
* This is also the default if your site/app
|
|
26
|
+
* does not use iframes
|
|
27
|
+
* {{/if}}
|
|
28
|
+
* </template>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
const notInIframe = () => !inIframe();
|
|
32
|
+
|
|
33
|
+
export { inIframe, notInIframe };
|
|
34
|
+
//# sourceMappingURL=iframe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iframe.js","sources":["../src/iframe.ts"],"sourcesContent":["/**\n * Returns true if the current frame is within an iframe.\n *\n * ```gjs\n * import { inIframe } from 'ember-primitives/iframe';\n *\n * <template>\n * {{#if (inFrame)}}\n * only show content in an iframe\n * {{/if}}\n * </template>\n * ```\n */\nexport const inIframe = () => window.self !== window.top;\n\n/**\n * Returns true if the current frame is not within an iframe.\n *\n * ```gjs\n * import { notInIframe } from 'ember-primitives/iframe';\n *\n * <template>\n * {{#if (notInIframe)}}\n * only show content when not in an iframe\n * This is also the default if your site/app\n * does not use iframes\n * {{/if}}\n * </template>\n * ```\n */\nexport const notInIframe = () => !inIframe();\n"],"names":["inIframe","window","self","top","notInIframe"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,QAAQ,GAAGA,MAAMC,MAAM,CAACC,IAAI,KAAKD,MAAM,CAACE,IAAG;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,WAAW,GAAGA,MAAM,CAACJ,QAAQ;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns true if the current frame is within an iframe.
|
|
3
|
+
*
|
|
4
|
+
* ```gjs
|
|
5
|
+
* import { inIframe } from 'ember-primitives/iframe';
|
|
6
|
+
*
|
|
7
|
+
* <template>
|
|
8
|
+
* {{#if (inFrame)}}
|
|
9
|
+
* only show content in an iframe
|
|
10
|
+
* {{/if}}
|
|
11
|
+
* </template>
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare const inIframe: () => boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Returns true if the current frame is not within an iframe.
|
|
17
|
+
*
|
|
18
|
+
* ```gjs
|
|
19
|
+
* import { notInIframe } from 'ember-primitives/iframe';
|
|
20
|
+
*
|
|
21
|
+
* <template>
|
|
22
|
+
* {{#if (notInIframe)}}
|
|
23
|
+
* only show content when not in an iframe
|
|
24
|
+
* This is also the default if your site/app
|
|
25
|
+
* does not use iframes
|
|
26
|
+
* {{/if}}
|
|
27
|
+
* </template>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare const notInIframe: () => boolean;
|
|
31
|
+
//# sourceMappingURL=iframe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iframe.d.ts","sourceRoot":"","sources":["../src/iframe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,QAAQ,eAAmC,CAAC;AAEzD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW,eAAoB,CAAC"}
|